sorts a query by a column

@param strColumn column to sort
@param order sort type (Query.ORDER_ASC or Query.ORDER_DESC)
@throws PageException
351516
@Override
    public synchronized void sort(String strColumn, int order) throws PageException {
	// disconnectCache();
	sort(getColumn(strColumn), order);
    }
10957
public static QueryColumn toQueryColumn(Object o) throws PageException {
	if (o instanceof QueryColumn) return (QueryColumn) o;
	throw new CasterException(o, "querycolumn");
    }
509144
final public function orderBy(string $orderBy, string $order = 'ASC')
    {        
       $this->query->addOrderBy($orderBy, $order);

        return $this;
    }
765110
@Override
	public AppEngineGetList<E> sort(Order<?, ?>... orders) {
		if (orders == null) {
			throw new IllegalArgumentException("'orders' must not be [" + orders + "]");
		}
		
		this.orders = Arrays.asList(orders);
		return this;
	}
611855
public function orderBy(string $column, string $type = null)
    {
        if ($type) {
            $type = strtoupper($type);

            if (!in_array($type, ['ASC', 'DESC'])) {
                throw new SqlException('Wrong ORDER type for statement.');
            }
        }

        $this->addOrderBy($this->dialect()->quoteName($column), $type);

        return $this;
    }
697855
private StringBuilder appendPagingSortSQL(final StringBuilder sql, final Post.Sort sort,final Paging paging) {

      if(paging.interval != null) {
         sql.append(" AND post_date");
         sql.append(paging.startIsOpen ? " >" : " >=");
         sql.append("?");

         sql.append(" AND post_date");
         sql.append(paging.endIsOpen ? " <" : " <=");
         sql.append("?");
      }

      switch(sort) {
         case ASC:
            sql.append(" ORDER BY post_date ASC");
            break;
         case DESC:
            sql.append(" ORDER BY post_date DESC");
            break;
         case ASC_MOD:
            sql.append(" ORDER BY post_modified ASC");
            break;
         case DESC_MOD:
            sql.append(" ORDER BY post_modified DESC");
            break;
         case ID_ASC:
            sql.append(" ORDER BY ID ASC");
            break;
         case ID_DESC:
            sql.append(" ORDER BY ID DESC");
            break;
         default:
            sql.append(" ORDER BY post_date DESC");
            break;
      }
      sql.append(" LIMIT ?,?");
      return sql;
   }
99424
public void sort(final int sortCol, final boolean sortAsc) {
		int[] rowIndexMappings = getTableModel().sort(sortCol, sortAsc);
		getOrCreateComponentModel().rowIndexMapping = rowIndexMappings;

		setSort(sortCol, sortAsc);

		if (rowIndexMappings == null) {
			// There's no way to correlate the previously selected row indices
			// with the new order of rows, so we need to clear out the selection.
			setSelectedRows(null);
			setExpandedRows(null);
		}
	}
1022913
public function orderBy($column, $orderType = 'ASC')
    {
        if (empty($column) || is_null($column)) {
            throw new \Exception('Empty parameter given to order by clause');
        }
        $this->orderType = $orderType;

        if (is_array($column)) {
            $this->columnName = $this->extractArrayAttributes($column);

            return $this;
        }

        if (is_null($this->columnName)) {
            $this->columnName = $column;
        }

        return $this;
    }
513656
@RequestMapping(path = "", method = RequestMethod.GET)
    public Page<Order> getOrder(Pageable pageable) {
        return orderService.getOrders(pageable);
    }
866901
public static String call(PageContext pc, Object var, boolean serializeQueryByColumns) throws PageException {
	return _call(pc, var, serializeQueryByColumns, pc.getWebCharset());
    }
296201
static <E extends Entity> String getSqlSort(EntityType entityType, Query<E> q) {
    StringBuilder sortSql = new StringBuilder();

    // https://www.postgresql.org/docs/9.6/static/queries-limit.html
    // When using LIMIT, it is important to use an ORDER BY clause that constrains the result rows
    // into a unique order.
    // Otherwise you will get an unpredictable subset of the query's rows. You might be asking for
    // the tenth through twentieth rows,
    // but tenth through twentieth in what ordering? The ordering is unknown, unless you specified
    // ORDER BY.
    Sort sort;
    if (q.getSort() != null && !hasUniqueSortAttribute(entityType, q.getSort())) {
      LOG.debug("Query with sort without unique attribute detected: {}", q);
      sort = new Sort(q.getSort());
      sort.on(entityType.getIdAttribute().getName());
    } else if (q.getSort() == null) {
      LOG.debug("Query without sort detected: {}", q);
      sort = new Sort(entityType.getIdAttribute().getName());
    } else {
      sort = q.getSort();
    }

    for (Sort.Order o : sort) {
      Attribute attr = entityType.getAttribute(o.getAttr());
      sortSql.append(", ").append(getColumnName(attr));
      if (o.getDirection().equals(Sort.Direction.DESC)) {
        sortSql.append(" DESC");
      } else {
        sortSql.append(" ASC");
      }
    }

    if (sortSql.length() > 0) {
      sortSql = new StringBuilder("ORDER BY ").append(sortSql.substring(2));
    }

    return sortSql.toString();
  }
348730
protected function parseOrder(Query $query, $order)
    {
        foreach ($order as $key => $val) {
            if ($val instanceof Expression) {
                $array[] = $val->getValue();
            } elseif (is_array($val) && preg_match('/^[\w\.]+$/', $key)) {
                $array[] = $this->parseOrderField($query, $key, $val);
            } elseif ('[rand]' == $val) {
                $array[] = $this->parseRand($query);
            } elseif (is_string($val)) {
                if (is_numeric($key)) {
                    list($key, $sort) = explode(' ', strpos($val, ' ') ? $val : $val . ' ');
                } else {
                    $sort = $val;
                }

                if (preg_match('/^[\w\.]+$/', $key)) {
                    $sort    = strtoupper($sort);
                    $sort    = in_array($sort, ['ASC', 'DESC'], true) ? ' ' . $sort : '';
                    $array[] = $this->parseKey($query, $key, true) . $sort;
                } else {
                    throw new Exception('order express error:' . $key);
                }
            }
        }

        return empty($array) ? '' : ' ORDER BY ' . implode(',', $array);
    }
656725
public void sort(final IndexedSortable s, int p, int r) {
		sortInternal(s, p, r, getMaxDepth(r - p));
	}
458505
private static Sort first(String columnName, Sort.Order order) {
        return Sort.on(columnName, order);
    }
51949
@Override
    public void setOrder(char order) {
        Preconditions.checkArgument(order == 'c' || order == 'f', "Order specified must be either c or f: got %s", String.valueOf(order));
        this.order = order;
    }
602493
protected function applySort($query, $searchStr)
    {
        if (empty($searchStr) || count($sortColumns = $this->sortColumns()) == 0) {
            return $query;
        }

        $sortColumns = array_map(function ($column) {
            return DB::raw("IFNULL(({$column}), '')");
        }, $sortColumns);

        $sqls              = [];
        $concatSortColumns = 'CONCAT('.join(',', $sortColumns).')';

        for ($i = 0, $j = strlen($searchStr); $i < $j; $i++) {
            $character = $searchStr[$i];

            $counter = $i + 1;
            $sqls[]  = "LOCATE('".addslashes($character)."', {$concatSortColumns}, {$counter})";
        }

        $query->addSelect(DB::raw('('.implode('+', $sqls).') AS sort_index'));
        $query->orderBy('sort_index', 'asc');

        return $query;
    }
319035
public void setSortcontrol(String sortControl) throws PageException {
	String[] sortControlArr = ArrayUtil.trim(ListUtil.toStringArray(ListUtil.listToArrayRemoveEmpty(sortControl, ',')));
	for (int i = 0; i < sortControlArr.length; i++) {
	    String scs = sortControlArr[i].trim().toLowerCase();

	    if (scs.equals("asc")) sortDirection = LDAPClient.SORT_DIRECTION_ASC;
	    else if (scs.equals("desc")) sortDirection = LDAPClient.SORT_DIRECTION_DESC;
	    else if (scs.equals("case")) sortType = LDAPClient.SORT_TYPE_CASE;
	    else if (scs.equals("nocase")) sortType = LDAPClient.SORT_TYPE_NOCASE;
	    else throw new ApplicationException("invalid value for attribute sortControl [" + sortControl + "], " + "valid values are [asc,desc,case,nocase]");
	}
    }