更新表中记录

@param string $table
@param array $row
@param mixed $cond 条件

@return int
430632
public function update($table, array $row, $cond=null)
	{
		return Sql::assistant( $this->ds )->update($table, $row, $cond);
	}
228864
public function sql_prependTableToFields($cond, $table) {
		$out = preg_replace_callback('/'.
			'(\w+\((?:[^)(]+|\((?:[^)(]+|(?R))*\))*\))|'.
			'(?:(\s)|^|(?<=[(]))'.
			'([a-zA-Z_](?:[\w\-_]+))'.
			'(?=[\s<>=!)]|$)/i',
			function($match) use($table) {
				if (!isset($match[3]))
					return $match[1];
				if (preg_match('/\b(AND|OR|IN|LIKE|NOT)\b/i',$match[3]))
					return $match[0];
				return $match[2].$table.'.'.$match[3];
			}, $cond);
		return $out ?: $cond;
	}
479759
public function cond($cond, $dash=false)
	{
		$ds = $this->ds();
		return SqlHelper::parse_cond($ds, $cond, $dash);
	}
467248
public function update(array $data, $where, $table = null)
    {
        $table = ($table) ?: $this->getTable();
        $sql = $this->getSql();
        $update = $sql->update($table);

        $update->set($data)
            ->where($where);

        $statement = $sql->prepareStatementForSqlObject($update);
        $result = $statement->execute();

        return $result->getAffectedRows();
    }
866756
public function AddRoute($cond,$hand) {
	/*//
	argv(string Condition, string Handler)
	return(self)
	//*/

		{{{ // parse the route conditions.
			if(!$this->IsRouteConditionValid($cond))
			throw new Exception("Route condition ({$cond}) is not valid.");

			list($domain,$path) = explode('//',$cond);

			if(strpos($path,'??') !== false) list($path,$query) = explode('??',$path);
			else $query = '';
		}}}

		{{{ // parse the route handler.
			if(!$this->IsRouteHandlerValid($hand))
			throw new Exception("Route handler ({$hand}) is not valid.");

			$handler = $this->TranslateRouteHandler($hand);
		}}}

		// throw in our extra data.
		$handler->SetDomain("`^{$this->TranslateRouteCondition($domain)}$`");

		if(Nether\Option::Get('nether-avenue-path-cs'))
		$handler->SetPath("`^\/{$this->TranslateRouteCondition($path)}$`");
		else
		$handler->SetPath("`^\/{$this->TranslateRouteCondition($path)}$`i");

		$handler->SetQuery(explode('&',$query));

		$this->Routes[] = $handler;
		return $this;
	}
953038
public function dbUpdate($table, $data, $condition = '')
    {
        if (is_array($data))
        {
            if (empty($condition)) $condition = 'id';
            $result = Eresus_CMS::getLegacyKernel()->db->
                updateItem($this->__table($table), $data, "`$condition` = '{$data[$condition]}'");
        }
        elseif (is_string($data))
        {
            $result = Eresus_CMS::getLegacyKernel()->db->
                update($this->__table($table), $data, $condition);
        }
        else
        {
            $result = false;
        }

        return $result;
    }
800121
public function incr_field($table, $field, $incr = 1, $cond=null)
    {
    	$incr = (int)$incr;
        if ($incr == 0) return false;
        
        $ds = $this->ds();
        $field = SqlHelper::qfield($field, $table);
        $cond = SqlHelper::parse_cond($ds,$cond);
        $sql = "UPDATE {$table} SET {$field} = {$field} + {$incr} " . (empty($cond) ? '' : "WHERE {$cond}");

        $result = Sql::write($ds, Sql::MODE_WRITE_UPDATE, [
				$sql
			]);
		return $result;
    }
771624
function _updateRowsCols($rowdata = null) {
        // Update maximum columns.
        $this->_max_cols = max($this->_max_cols, count($rowdata));

        // Update maximum rows.
        ksort($this->_data);
        $keys = array_keys($this->_data);
        $this->_max_rows = end($keys) + 1;

        switch ($this->_defaultAlign) {
            case self::CONSOLE_TABLE_ALIGN_CENTER:
                $pad = STR_PAD_BOTH;
                break;
            case self::CONSOLE_TABLE_ALIGN_RIGHT:
                $pad = STR_PAD_LEFT;
                break;
            default:
                $pad = STR_PAD_RIGHT;
                break;
        }

        // Set default column alignments
        for ($i = 0; $i < $this->_max_cols; $i++) {
            if (!isset($this->_col_align[$i])) {
                $this->_col_align[$i] = $pad;
            }
        }
    }
720569
final public function join($table, $cond, $type = 'LEFT')
    {

        if ($type != '') {
            $type = strtoupper(trim($type));

            if (!in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'))) {
                $type = '';
            } else {
                $type .= ' ';
            }
        }
        // Extract any aliases that might exist.  We use this information
        // in the _protect_identifiers to know whether to add a table prefix
        $this->traceTableAlias($table);

        // Strip apart the condition and protect the identifiers
        if (preg_match('/([\w\.]+)([\W\s]+)(.+)/', $cond, $match)) {
            $match[1] = $this->identifiers($match[1]);
            $match[3] = $this->identifiers($match[3]);

            $cond = $match[1] . $match[2] . $match[3];
        }
        // Assemble the JOIN statement
        $join = $type . 'JOIN ' . $this->identifiers($table) . ' ON ' . $cond;

        $this->arrayJoin[] = $join;
        if ($this->arrayCaching === TRUE) {
            $this->arrayCacheJoin[] = $join;
            $this->arrayCacheExists[] = 'join';
        }

        return $this;
    }
357871
public function inserts($table, $rows)
	{
        if (!$rows) {
            return false;
        }

		$holds = array();

		$feilds = array_keys(reset($rows));

        $hold = '('.implode(',', array_fill(0, count($feilds), '?')).')';
		$holds = implode(",\n", array_fill(0, count($rows), $hold));
		$feilds = implode("`,`", $feilds);

        $vals = [];
        foreach ($rows as $row) {
            $vals = array_merge($vals, array_values($row));
        }

		$sql = "INSERT INTO `{$table}` (`{$feilds}`)\n VALUES {$holds}";

        $stmt = $this->prepare($sql);
        return $stmt ? $stmt->execute($vals) : false;
	}
512808
private function updateBoundColumns(array $row)
    {
        foreach ($this->columnBinding as $column => &$metadata) {
            $index = $this->collection->getColumnIndex($column);
            if ($index === null) {
                // todo: I would like to throw an exception and tell someone they screwed up
                // but i think that would violate the PDO api
                continue;
            }

            // Update by reference
            $value           = $this->typedValue($row[$index], $metadata['type']);
            $metadata['ref'] = $value;
        }
    }
206304
public function insert($table, $row)
	{
		$keys = implode('`, `', array_keys($row));
        $holds = implode(',', array_fill(0, count($row), '?'));
		$vals = array_values($row);

		$sql = "INSERT INTO `{$table}` (`{$keys}`) VALUES({$holds})";

        $stmt = $this->prepare($sql);
        return $stmt ? $stmt->execute($vals) : false;
	}
1117065
public function update(array $cols): int
    {
        $this->cols = $cols;
        $pdoStatement = $this->provideStatement();
        $pdoStatement = $this->execute($pdoStatement);
        return $pdoStatement->rowCount();
    }
108174
public function row(array $data): int
    {
        array_push($this->rows, $data);
        $pdoStatement = $this->provideStatement();
        $this->execute($pdoStatement);
        return $this->getLastInsertId();
    }
540214
public function del($table, $cond=null)
	{
		$ds = $this->ds();
		$cond = SqlHelper::parse_cond($ds, $cond);
		$table = SqlHelper::qtable($table);
		
		$sql = "DELETE FROM {$table} " . (empty($cond) ? '' : "WHERE {$cond}");
		
		$result = Sql::write($ds, Sql::MODE_WRITE_DELETE, [
				$sql
			]);
		return $result;
	}
32658
protected final function update($data = null, $con = null, $cb = null) {
        if ($data === null) {
            $sql = new UpdateSQL($this->qualifiedName);
            $sql->setDialect($this->dialect);

            return $sql;
        }
        if ($con && !is_array($con)) {
            $con = [$this->primaryKeys[0] => $con];
        }
        if (!$con) {
            $con = $this->getWhere($data);
            if (count($con) != count($this->primaryKeys)) {
                $this->errors = '未提供更新条件';

                return false;
            }
        }
        if (empty ($con)) {
            $this->errors = '更新条件为空';

            return false;
        }
        if ($cb && $cb instanceof \Closure) {
            $data = $cb ($data, $con, $this);
        }
        if ($data) {
            $this->filterFields($data);
            if (method_exists($this, 'validateUpdateData')) {
                if (isset($this->_formData)) {
                    $this->validateUpdateData($this->_formData);
                } else {
                    $this->validateUpdateData($data);
                }
            }
            $sql = new UpdateSQL($this->table);
            $sql->set($data)->setDialect($this->dialect)->where($con);
            $rst = $sql->exec();
            $this->checkSQL($sql);

            return $rst;
        } else {
            return false;
        }
    }
98731
public function notIn($item, array $list, $cond = null, $not = true)
    {
        return $this->in($item, $list, $cond, $not);
    }