DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
SortColumn.cs
Go to the documentation of this file.
1 //
2 // Copyright 2010-2015 Deveel
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 using System;
18 
20 
21 namespace Deveel.Data.Sql {
26  public sealed class SortColumn : IPreparable {
35  public SortColumn(SqlExpression expression, bool ascending) {
36  Expression = expression;
37  Ascending = ascending;
38  }
39 
45  public SortColumn(SqlExpression expression)
46  : this(expression, true) {
47  }
48 
57  public SortColumn(string expression, bool ascending)
58  : this(SqlExpression.Parse(expression), ascending) {
59  }
60 
66  public SortColumn(string expression)
67  : this(expression, true) {
68  }
69 
73  public SqlExpression Expression { get; internal set; }
74 
79  public bool Ascending { get; private set; }
80 
82  var exp = Expression;
83  if (exp != null) {
84  exp = exp.Prepare(preparer);
85  }
86 
87  return new SortColumn(exp, Ascending);
88  }
89  }
90 }
SortColumn(string expression)
Constructs the BY column reference with the expression given and the ascending sort order...
Definition: SortColumn.cs:66
SortColumn(SqlExpression expression)
Constructs the BY column reference with the expression given and the ascending sort order...
Definition: SortColumn.cs:45
SortColumn(SqlExpression expression, bool ascending)
Constructs the BY column reference with the expression and the sort order given.
Definition: SortColumn.cs:35
An interface used to prepare a SqlExpression object.
object Prepare(IExpressionPreparer preparer)
Converts the underlying value of this instance into an object that can be evaluated by an expression...
SortColumn(string expression, bool ascending)
Constructs the BY column reference with the expression and the sort order given.
Definition: SortColumn.cs:57
Defines the base class for instances that represent SQL expression tree nodes.
Object used to represent a column in the ORDER BY clauses of a select statement.
Definition: SortColumn.cs:26
A contract for objects that participate to a SqlExpression.Prepare phase of an expression evaluation...
Definition: IPreparable.cs:30