Override default column ordering.

@param string $column
@param string $sql
@param array $bindings
@return $this
@internal string $1 Special variable that returns the requested order direction of the column.
544480
public function orderColumn($column, $sql, $bindings = [])
    {
        $this->columnDef['order'][$column] = ['method' => 'orderByRaw', 'parameters' => [$sql, $bindings]];

        return $this;
    }
167015
public function order(string $sql, array $params = []) : self
    {
        $this->qiterator = null;
        $name = null;
        if (!count($params)) {
            $name = preg_replace('(\s+(ASC|DESC)\s*$)i', '', $sql);
            try {
                $name = $this->getColumn(trim($name))['name'];
            } catch (\Exception $e) {
                $name = null;
            }
        }
        $this->order = [ $sql, $params, $name ];
        return $this;
    }
220597
public function select($column, ...$columns) {
        $this->params = [];
        if (count($columns)) {
            array_unshift($columns, $column);
            $columnStr = implode('`,`', $columns);
            $this->sql = "SELECT `{$columnStr}` ";
        } else {
            $this->sql = "SELECT {$column} ";
        }
        return $this;
    }
1122602
public function query(string $sql, array $bindings = []): IQueryBuilderHandler
    {
        $queryObject = new QueryObject($sql, $bindings, $this->getConnection());
        $this->connection->setLastQuery($queryObject);

        $this->fireEvents(EventHandler::EVENT_BEFORE_QUERY, $queryObject);

        [$response, $executionTime] = $this->statement($queryObject->getSql(), $queryObject->getBindings());

        $this->fireEvents(EventHandler::EVENT_AFTER_QUERY, $queryObject, [
            'execution_time' => $executionTime,
        ]);

        $this->pdoStatement = $response;

        return $this;
    }
686658
public function sqlFetchColumn(string $sql, array $params = [], string $column = '0')
    {
        return $this->connection()->sqlFetchColumn($sql, $params, $column);
    }
239648
public function statement($sql, $bindings = array())
		{
			list($statement, $result) = $this->execute($sql, $bindings);
			return $result;
		}
394322
public function query($sql, $bindings = array())
    {
        list($this->pdoStatement) = $this->statement($sql, $bindings);

        return $this;
    }
1208083
public function update($sql, $bindings = array())
		{
			list($statement, $result) = $this->execute($sql, $bindings);
			return $statement->rowCount();
		}
778586
public function order($columns, $direction = 'ASC')
    {
        foreach ((array) $columns as $column)
        {
            $this->order[] = array(
                'column'    => $column,
                'direction' => $direction
            );
        }

        return $this;
    }
601633
public function setSortData($column, $direction = null)
    {
        if (null === $column) {
            return $this->clearSortData();
        }

        session()->put($this->getSessionKey(static::TYPE_SORT), [
            'column'    => $column,
            'direction' => $direction,
        ]);

        return $this;
    }
452560
public function orderBy($column, $direction = 'ASC')
    {
        $orderVal         = [
            'ASC'  => 1,
            'DESC' => -1,
        ];
        $this->ordering[] = [
            'column'    => $column,
            'direction' => $orderVal[strtoupper($direction)],
        ];

        return $this;
    }
683892
public function orWhereRaw(string $sql, array $bindings = []): BaseQueryRelateContract
    {
        $this->query->orWhereRaw($sql, $bindings);

        return $this;
    }
44267
public function queryValue(string $sql, string $column, $default = null)
    {
        $result = $default;
        if ($row = $this->query($sql)->fetch(PDO::FETCH_ASSOC)) {
            $result = $row[$column];
        }

        return $result;
    }
1082652
private function binding(\PDOStatement $sql, array $bindings = []): \PDOStatement
    {
        foreach ($bindings as $binding=>$value) {
            if (!is_array($value)) {
                $sql->bindValue($binding, $value);
            } else {
                switch(strtolower($value[1])) {
                    case 'date':
                        $sql->bindValue($binding, $this->time($value[0], 'Y-m-d'), \PDO::PARAM_STR);
                        break;
                    case 'time':
                        $sql->bindValue($binding, $this->time($value[0], 'Y-m-d H:i:s.u'), \PDO::PARAM_STR);
                        break;
                    case 'bool':
                    case 'boolean':
                        $sql->bindValue($binding, boolval($value[0]), \PDO::PARAM_BOOL);
                        break;
                    case 'null':
                        $sql->bindValue($binding, NULL, \PDO::PARAM_NULL);
                        break;
                    case 'int':
                    case 'integer':
                    case 'number':
                    case 'limit':
                    case 'offset':
                        $sql->bindValue($binding, intval($value[0]), \PDO::PARAM_INT);
                        break;
                    case 'str':
                    case 'string':
                    case 'text':
                    case 'float':
                    case 'varchar':
                    case 'varchar2':
                        $sql->bindValue($binding, strval($value[0]), \PDO::PARAM_STR);
                        break;
                    case 'lob':
                    case 'large':
                    case 'object':
                    case 'blob':
                        $sql->bindParam($binding, $value[0], \PDO::PARAM_LOB, strlen($value[0]));
                        break;
                    case 'like':
                        $sql->bindValue($binding, '%'.$value[0].'%', \PDO::PARAM_STR);
                        break;
                    default:
                        if (is_int($value[1])) {
                            $sql->bindValue($binding, $value[0], $value[1]);
                        } else {
                            $sql->bindValue($binding, strval($value[0]), \PDO::PARAM_STR);
                        }
                }
            }
        }
        return $sql;
    }
869039
final protected function order_by($column, $order = 'ASC'){
        $order = 'DESC' === strtoupper($order) ? 'DESC' : 'ASC';
        $this->_order_by[] = sprintf('%s %s', $this->escape_column_name($column), $order);
        return $this;
    }
254456
public function order(string $column, string $method = "DESC") : QueryBuilder
    {
        $this->_query[] = "ORDER BY";
        $this->_query[] = "`". $this->sanitize($column) ."`";
        $this->_query[] = (strtoupper($method) === "DESC") ? "DESC" : "ASC";

        return $this;
    }
445213
public function orderBy($column, $direction = 'asc')
    {
        $this->{$this->unions ? 'unionOrders' : 'orders'}[] = [
            'column' => $column,
            'direction' => strtolower($direction) == 'asc' ? 'asc' : 'desc',
        ];

        return $this;
    }