自减/增一个字段
@param mixed $column 字段名,可以使用一个数组传递多个字段
@param mixed $amount 自增的数制默认为1，如果是一个数组则对应前面的字段也必须为数组，如果column为数组此参数不为数组则默认所有字段增加相同的值
@return bool                    执行sql的结果
@throws \vitex\core\Exception
545850
private function stepField($column, $amount)
    {
        if (!$this->DB) {
            throw  new Exception('您还没有连接数据库', Exception::CODE_DATABASE_ERROR);
        }
        if (is_array($column)) {
            if (is_array($amount) && count($amount) != count($column)) {
                throw new Exception("传递的字段与自增值无法对应，请查看数量", Exception::CODE_PARAM_NUM_ERROR);
            }
        } else {
            $column = [$column];
        }

        $sql = "update " . $this->getTable() . " set ";
        $sets = [];
        foreach ($column as $key => $val) {
            if (is_array($amount)) {
                $num = $amount[$key];
            } else {
                $num = $amount;
            }
            $val = $this->formatColumn($val);
            $sets[] = $val . " = (" . $val . " + " . $num . ") ";
        }
        $sql .= implode(',', $sets);
        $sql .= $this->buildWhere();
        $this->sql = $sql;
        /**
         * 只获取sql
         */
        if ($this->justSql) {
            return true;
        }
        $ret = $this->DB->execute($sql);

        $this->resetCon();
        return $ret;
    }
684268
public function getCol($column = 0)
    {
        $sql = $this->toSQL();
        return $this->table->getCol($sql, $this->getParams(), $column);
    }
691572
public function rows($column = '*', $where = null, $params = []) {

		if(null === $this -> getAdapter()) {
			return trigger_error(sprintf('No database adapter was set in "%s"', __METHOD__), E_USER_ERROR);
		}

		if(false === is_string($column)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($column)), E_USER_ERROR);
		}

		if(null !== $where && false === is_string($where)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($where)), E_USER_ERROR);
		}

		if(false === is_array($params)) {
			return trigger_error(sprintf('Argument 3 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($params)), E_USER_ERROR);
		}

		$query  = [];

		//Select
		$query[] = sprintf('SELECT COUNT(%s) AS amount FROM %s', $this -> getAdapter() -> escape($column), $this -> getAdapter() -> escape($this -> getTable()));

		//Where
		if(null !== $where) {
			$query[] = sprintf('WHERE %s', $this -> getAdapter() -> escape($where));
		}

		$statement = $this -> getAdapter() -> query(implode(' ', $query), $params) -> execute();

		if(true === $statement) {

			$amount = $this -> getAdapter() -> toArray();

			if(true === isset($amount[0]['amount'])) {
				return $amount[0]['amount'];
			}
		}

		return false;
	}
434533
public function increment($column, $value)
    {
        $this->params[':column'] = $value;
        $query = "UPDATE `{$this->table}` {$this->join} SET `$column` = `$column` + :$column";
        if ($this->condition) {
            $query .= " WHERE {$this->condition}";
        }
        if ($this->limit) {
            $query .= " LIMIT {$this->limit}";
        }

        return $this->connection->execQuery($query, $this->params);
    }
578817
public function validateBasketAmount($amount)
    {
        $amount = str_replace(',', '.', $amount);

        if (!is_numeric($amount) || $amount < 0) {
            /**
             * @var \OxidEsales\Eshop\Core\Exception\ArticleInputException $exception
             */
            $exception = oxNew(\OxidEsales\Eshop\Core\Exception\ArticleInputException::class);
            $exception->setMessage(\OxidEsales\Eshop\Core\Registry::getLang()->translateString('ERROR_MESSAGE_INPUT_INVALIDAMOUNT'));
            throw $exception;
        }

        if (!\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blAllowUnevenAmounts')) {
            $amount = round(( string ) $amount);
        }

        //negative amounts are not allowed
        //$dAmount = abs($dAmount);

        return $amount;
    }
616768
public function count($column = '*')
    {
        if (!$this->DB) {
            throw  new Exception('您还没有连接数据库', Exception::CODE_DATABASE_ERROR);
        }
        $sql = $this->buildSql($column);
        $this->sql = $sql;
        /**
         * 仅仅获取sql，不实际执行
         */
        if ($this->justSql) {
            return 0;
        }
        $info = $this->DB->query($sql)->fetch(\PDO::FETCH_ASSOC);
        $this->lastQueryAt = time();
        return isset($info['num']) ? $info['num'] : 0;
    }
251024
public function setAmount($amount)
    {
        $amount = (int) (string) $amount;

        if (!Icepay_Parameter_Validation::amount($amount))
            throw new Exception('Amount not valid');
        $this->data->ic_amount = $amount;
        return $this;
    }
811435
public function chunk($count, $callback, $column = null, $order = 'asc')
    {
        $column    = $column ?: $this->getPk();
        $options   = $this->getOptions();
        $resultSet = $this->limit($count)->order($column, $order)->select();

        while (!empty($resultSet)) {
            if (false === call_user_func($callback, $resultSet)) {
                return false;
            }
            $end       = end($resultSet);
            $lastId    = is_array($end) ? $end[$column] : $end->$column;
            $resultSet = $this->options($options)
                ->limit($count)
                ->where($column, 'asc' == strtolower($order) ? '>' : '<', $lastId)
                ->order($column, $order)
                ->select();
        }
        return true;
    }
894996
final public function field($column)
    {
        $key = $column;
        if (strpos($column, '.') !== false) {
            list(, $key) = explode('.', $column);
        }
        $key = str_replace('`', '', $key);
        $this->select($column);
        $info = $this->get();
        if (!isset($info[$key])) {
            throw  new Exception('参数错误，您的参数只能为 field 或者 table.field的形式', Exception::CODE_PARAM_VALUE_ERROR);
        }
        return $info[$key];
    }
1055581
public function select(string $column, string ...$columns)
    {
        $instance = $this->selectQueryInstance();

        $instance->selectQuery()->columns($column, ...$columns);

        return $instance;
    }
718745
public function count($column = null){
		if($column === null){
			$this->performed || $this->run();
			return (int) $this->connection->getDriver()->getNumRows($this->resultSet);
		}
		return $this->aggregation("COUNT(:$column)");
	}
956059
private function _count($method, $column = NULL)
    {
        $this->options['limit']['0'] = 1;
        if($method == 'distinct')
            if(is_null($column)) // 默认id
                $this->options['field']['0'] = 'count(' . $method . ' `' . $this->key . '`) as count';
            else
                $this->options['field']['0'] = 'count(' . $method . ' `' . $column . '`) as count';
        elseif(is_null($column) && $method == 'count') // 默认*
            $this->options['field']['0'] = $method . '(*) as count';
        elseif($column)
            $this->options['field']['0'] = $method . '(`' . $column . '`) as count';
        else // 默认id
            $this->options['field']['0'] = $method . '(`' . $this->key . '`) as count';
        $result = $this->query($this->_parseSql(), $this->prepareParam, false);
        return isset($result->count) ? $result->count : 0;
    }
487991
public function alias(String $column, String $alias)
	{
		// if (!$this->getBinding('select') || empty($this->getBinding('select'))) {
			// Since this method cannot be used without the SELECT statement,
			// we will throw an exception if `SELECT` binding is null or false. 
			// throw new RuntimeException(sprintf('Cannot call aggregate function on empty select.'));
		// }
		$alias = str_replace($this->generator->getDisallowedChars(), '', $alias);
		return $this->attachSeparator($column . ' AS ' . $alias);
	}
243162
public function indexExists( $table, $columns = [ ] )
    {
        if ( !is_array( $columns ) )
        {
            throw new Exception( 'columns must be an array' );
        }

        $query = "SELECT * FROM information_schema.statistics WHERE table_schema =
                 ? AND table_name = ? AND ";

        $params = [ $this->name, $table ];

        foreach ( $columns as $column )
        {
            $query .= "column_name = ? OR ";
            $params[ ] = &$column;
        }

        $query = rtrim( $query, ' OR ' );

        $statement = $this->database->prepare( $query );
        $statement->execute( $params );

        $result = $statement->fetchAll();

        return !empty( $result );
    }
242973
public function select($column, $as = null, $count = false)
	{
		$this->syntax->setSelect($column, $as, $count);
		$this->type = 'select';
		return $this;
	}
275255
public function execSql($sql)
    {
        try {
            list ($statement) = explode(" ", ltrim($sql));
            if (in_array(strtoupper($statement), array('SELECT', 'SHOW'))) {
                $oStatement = $this->query($sql);
            } else {
                return $this->exec($sql);
            }

            return $oStatement;
        } catch (PDOException $e) {
            throw new Exception("Could not execute sql: " . $sql);
        }
    }
871001
public function seek($column = 'A')
    {
        $column = PHPExcel_Cell::columnIndexFromString($column) - 1;
        if (($column < $this->startColumn) || ($column > $this->endColumn)) {
            throw new PHPExcel_Exception("Column $column is out of range ({$this->startColumn} - {$this->endColumn})");
        }
        $this->position = $column;

        return $this;
    }