Represents a column/expression to order the result set by.
Extends Static PropertiesProperty | Type | Default Value | Description |
INVERT_NULLS | Object |
{first:"last", last:"first"}
| Hash that contains the inversions for "first" and "last". |
Property | Type | Default Value | Description |
descending | Boolean | true | READ ONLY true if decending, false otherwise. |
expression | READ ONLY the expression to order. | ||
nulls | String | null | if value is "first" the null values will be first, if "last" then null values will be last |
- function (expression,descending,opts){
- descending = isBoolean(descending) ? descending : true;
- opts = opts || {};
- this.__expression = expression;
- this.__descending = descending;
- var nulls = isString(opts) ? opts : opts.nulls;
- this.__nulls = isString(nulls) ? nulls.toLowerCase() : null;
- }
patio.sql.OrderedExpression
a copy that is ordered ASC
- function (){
- return new OrderedExpression(this.__expression, false, {nulls: this.__nulls});
- }
patio.sql.OrderedExpression
Return a copy that is ordered DESC
- function (){
- return new OrderedExpression(this.__expression, true, {nulls: this.__nulls});
- }
*
Returnspatio.sql.OrderedExpression
an inverted expression, changing ASC to DESC and NULLS FIRST to NULLS LAST.
- function (){
- return new OrderedExpression(this.__expression, !this.__descending, {nulls: this._static.INVERT_NULLS[this.__nulls] || this.__nulls});
- }
Converts the patio.sql.OrderedExpression to a string.
Argumentsdataset used to created the SQL fragment, if the dataset is ommited then the default patio.Dataset implementation is used.
String the SQL version of the patio.sql.OrderedExpression.
- function (ds){
- !Dataset && (Dataset = require("./dataset"));
- ds = ds || new Dataset();
- return ds.orderedExpressionSql(this);
- }