Perform default query orderBy clause.
971714
protected function defaultOrdering()
    {
        $criteria = $this->request->orderableColumns();
        if (! empty($criteria)) {
            $sorter = $this->getSorter($criteria);

            $this->collection = $this->collection
                ->map(function ($data) {
                    return array_dot($data);
                })
                ->sort($sorter)
                ->map(function ($data) {
                    foreach ($data as $key => $value) {
                        unset($data[$key]);
                        array_set($data, $key, $value);
                    }

                    return $data;
                });
        }
    }
290699
protected function order()
    {
        $column = $this->getParamAdapter()->getColumn();
        $order = $this->getParamAdapter()->getOrder();
        if ($column) {
            $this->select->reset('order');
            $this->select->order($column . ' ' . $order);
        }
    }
238443
def query_all(kind='1', by_count=False, by_order=True):
        '''
        
        '''
        if by_count:
            recs = TabTag.select().where(TabTag.kind == kind).order_by(TabTag.count.desc())
        elif by_order:
            recs = TabTag.select().where(TabTag.kind == kind).order_by(TabTag.order)
        else:
            recs = TabTag.select().where(TabTag.kind == kind).order_by(TabTag.uid)
        return recs
296873
function orderResults (results) {
    // get id column names
    var idColumn = this.model.defaultColumnsInverse.id
    // require id column for model
    if (!defined(idColumn)) {
        return results
    }
    // get id column name that was used for query
    var queryIdColumn = defined(this.args.where.id)
        ? 'id'
        : defined(this.args.where[idColumn])
            ? idColumn
            : undefined
    // if query was not on id column then do not reorder
    if (!defined(queryIdColumn)) {
        return results
    }
    // list of ids as querired
    var queryIds
    // if id property is array then get ids
    if (Array.isArray(this.args.where[queryIdColumn])) {
        queryIds = this.args.where[queryIdColumn]
    }
    // if id has an in query with array then get ids
    else if (typeof this.args.where[queryIdColumn] === 'object' && Array.isArray(this.args.where[queryIdColumn].in)) {
        queryIds = this.args.where[queryIdColumn].in
    }
    // if query is not by list of ids then do not reorder
    if (!defined(queryIds)) {
        return results
    }
    // group results by id - if current record was queried then must use
    // the id that column was selected by instead of record id
    var resultsById = _.keyBy(results, this.args.current ? idColumn+'Select' : idColumn)
    // ordered result set
    var orderedRes = []
    // iterate over queried ids and add to ordered result set
    _.each(queryIds, queryId => {
        if (defined(resultsById[queryId])) {
            orderedRes.push(resultsById[queryId])
        }
    })

    return orderedRes
}
235897
def _get_order_by(self, request):
        
        attr = request.params.get('sort', request.params.get('order_by'))
        if attr is None or not hasattr(self.mapped_class, attr):
            return None
        if request.params.get('dir', '').upper() == 'DESC':
            return desc(getattr(self.mapped_class, attr))
        else:
            return asc(getattr(self.mapped_class, attr))
353440
def all(self, order_by=None, limit=0):
        
        with rconnect() as conn:
            try:
                query = self._base()
                if order_by is not None:
                    query = self._order_by(query, order_by)
                if limit > 0:
                    query = self._limit(query, limit)

                log.debug(query)
                rv = query.run(conn)
            except Exception as e:
                log.warn(e)
                raise
            else:
                data = [self._model(_) for _ in rv]
                return data
895258
async def sort(self, request, reverse=False):
        """"""
        return sorted(
            self.collection, key=lambda o: getattr(o, self.columns_sort, 0), reverse=reverse)
852452
public Query orderedBy( List<Ordering> orderings ) {
        return new Query(source, constraint, orderings, columns, getLimits(), distinct);
    }
57101
public function orderBy($fields, $defaultDirection = 'ASC')
    {
        if (!is_array($fields)) {
            $fields = array($fields);
        }

        foreach ($fields as $key => $value) {
            $field = $key;
            $type = $value;
            if (is_int($key)) {
                $field = $value;
                $type = $defaultDirection;
            }
            if (!$field instanceof Raw) {
                $field = $this->addTablePrefix($field);
            }
            $this->statements['orderBys'][] = compact('field', 'type');
        }

        return $this;
    }
1298382
function get(tableName, fieldNames, where, orderBy) {
    if (orderBy && !checkOrderBy(orderBy)) {
      throw new Error('Invalid arg: orderBy');
    }
    if (!db) {
      throw new Error('Not connected');
    }
    let sql = `SELECT ${fieldNames.join(',')} FROM ${tableName}`;
    if (where) {
      sql += ` WHERE ${where}`;
    }
    if (orderBy) {
      sql += ` ORDER BY ${orderBy.join(',')}`;
    }
    return new Promise(((resolve, reject) => {
      db.get(sql, [], (error, row) => {
        if (error) {
          reject(error);
        } else {
          resolve(row);
        }
      });
    }));
  }
972146
def _get_query(self, order=None, filters=None):
        
        order = self._get_order(order)
        return self.posts.all().order_by(order)
696847
def orderBy(self, field, direct="desc"):
        
        if direct == "desc":
            self._query = self._query.order_by(r.desc(field))
        else:
            self._query = self._query.order_by(r.asc(field))

        return self
1347325
private function setQueryOrder()
    {
        if ($this->hasInput('column_orders'))
        {
            // before we process the order, we need to check if
            // single order is set.
            // and remove other column_orders keys and method except for the single order
            // specified.
            if ($this->hasInput('single_order') && isset($this->columns[$this->getInput('single_order')]))
            {
                // single_order might empty
                $single_order = $this->getInput('single_order');

                if ( ! empty($single_order))
                {
                    foreach ($this->requestParameters['column_orders'] as $key => $value)
                    {
                        if ($key != $single_order)
                        {
                            unset($this->requestParameters['column_orders'][$key]);
                        }
                    }
                }
            }

            // overide default column_orders keys and methods
            $column_orders_input = $this->getInput('column_orders');
            if (!empty($column_orders_input) && is_array($column_orders_input))
            {
                // $input_orders method
                foreach ($column_orders_input as $order_by => $order_method)
                {
                    if (!array_key_exists($order_by, $this->columns))
                    {
                        unset($column_orders_input[$order_by]);
                    }
                    else
                    {
                        if (!is_string($order_method) || !in_array($order_method, array('asc', 'desc')))
                        {
                            $column_orders_input[$order_by] = 'asc';
                        }
                    }
                }

                // override default order
                $this->columnOrders = $column_orders_input;
            }
        }

        // load default column_orders
        // no need to perform validation since
        // tblist assumes that it is a system generated data
        // not user generated data.
        foreach ($this->columnOrders as $column_key => $order_method)
        {
            // just set the default order query string
            // just like: order by column_name desc
            $table_column = $this->getColumnOption($column_key, self::COLUMN_OPTION_TABLE_COLUMN, $column_key);
            $this->query->orderBy($table_column, $order_method);
        }
    }
116725
public Query orderby(final Collection<? extends Expression> orderbyColumns) {
        if (orderbyColumns == null) {
            return this;
        }

        this.orderbyColumns.addAll(orderbyColumns);

        return this;
    }
322142
public Query<S> query(Filter<S> filter, FilterValues<S> values, OrderingList<S> ordering)
        throws FetchException
    {
        return query(filter, values, ordering, null);
    }
1194621
@Nonnull
  public Query orderBy(@Nonnull FieldPath fieldPath) {
    return orderBy(fieldPath, Direction.ASCENDING);
  }
845285
public Cursor query(SQLiteDatabase db, String[] columns, String orderBy) {
        return query(db, columns, null, null, orderBy, null);
    }