18 using System.Collections.Generic;
21 namespace Deveel.Data.Sql.Expressions {
34 if (expression == null)
38 switch (expressionType) {
93 return expression.
Accept(
this);
114 for (
int i = 0; i < list.Length; i++) {
115 result[i] = Visit(list[i]);
127 var ags = VisitExpressionList(expression.
Arguments);
137 var left = binaryEpression.
Left;
138 var right = binaryEpression.
Right;
142 right = Visit(right);
155 operand = Visit(operand);
167 return castExpression;
190 if (reference != null)
191 reference = Visit(reference);
194 if (expression != null)
195 expression = Visit(expression);
222 ifTrue = Visit(ifTrue);
224 ifFalse = Visit(ifFalse);
237 list = VisitExpressionList(list);
248 var selectColumns =
new List<SelectColumn>();
249 foreach (var column
in query.SelectColumns) {
250 var newColumn =
new SelectColumn(Visit(column.Expression), column.Alias);
251 newColumn.InternalName = column.InternalName;
252 newColumn.ResolvedName = column.ResolvedName;
253 selectColumns.Add(newColumn);
258 if (query.FromClause != null)
259 newQuery.FromClause = VisitFromClause(query.FromClause);
261 if (query.WhereExpression != null)
262 newQuery.WhereExpression = Visit(query.WhereExpression);
263 if (query.HavingExpression != null)
264 newQuery.HavingExpression = Visit(query.HavingExpression);
266 if (query.GroupBy != null)
267 newQuery.GroupBy = VisitExpressionList(newQuery.GroupBy.ToArray());
269 newQuery.GroupMax = query.GroupMax;
270 newQuery.Distinct = query.Distinct;
272 if (query.NextComposite != null) {
273 var visitedComposite = Visit(query.NextComposite);
277 newQuery.CompositeFunction = query.CompositeFunction;
278 newQuery.IsCompositeAll = query.IsCompositeAll;
override SqlExpressionType ExpressionType
ObjectName ReferenceName
Gets the name of the object referenced by the expression.
SqlExpression Operand
Gets the operand expression that is computed.
FromClause VisitFromClause(FromClause fromClause)
SqlExpression ValueExpression
An expression that references an object within a context.
Handles expressions computed against an unary operator.
virtual SqlExpression VisitFunctionCall(SqlFunctionCallExpression expression)
Visits the expression that calls the function defined.
virtual SqlExpression VisitUnary(SqlUnaryExpression unary)
static SqlTupleExpression Tuple(SqlExpression[] expressions)
virtual SqlExpression VisitTuple(SqlTupleExpression expression)
An SqlExpression that will cast a value retrieved by the evaluation of another expression into a give...
static SqlVariableReferenceExpression VariableReference(string varName)
static SqlAssignExpression Assign(SqlExpression reference, SqlExpression valueExpression)
static SqlConditionalExpression Conditional(SqlExpression testExpression, SqlExpression ifTrue)
SqlExpressionType
All the possible type of SqlExpression supported
SqlExpression TestExpression
DataObject Value
Gets the constant value of the expression.
virtual SqlExpression[] VisitExpressionList(SqlExpression[] list)
Visits a list of expressions given.
SqlExpression FalseExpression
virtual SqlExpression VisitQuery(SqlQueryExpression query)
virtual SqlExpression VisitBinary(SqlBinaryExpression binaryEpression)
A container for the FROM clause of a select statement.
virtual SqlExpression VisitCast(SqlCastExpression castExpression)
virtual SqlExpression VisitReference(SqlReferenceExpression reference)
SqlExpression[] Arguments
Represents a column selected to be in the output of a select statement.
virtual SqlExpression VisitConditional(SqlConditionalExpression conditional)
An expression that holds a constant value.
virtual SqlExpression VisitConstant(SqlConstantExpression constant)
static SqlReferenceExpression Reference(ObjectName objectName)
virtual SqlExpression Accept(SqlExpressionVisitor visitor)
SqlExpression TrueExpression
override SqlExpressionType ExpressionType
SqlExpression[] Expressions
static SqlBinaryExpression Binary(SqlExpression left, SqlExpressionType expressionType, SqlExpression right)
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
static SqlFunctionCallExpression FunctionCall(ObjectName functionName)
abstract SqlExpressionType ExpressionType
Gets the type code of this SQL expression.
virtual SqlExpression VisitVariableReference(SqlVariableReferenceExpression reference)
A visitor for SqlExpression objects.
virtual SqlExpression VisitAssign(SqlAssignExpression assign)
static SqlUnaryExpression Unary(SqlExpressionType expressionType, SqlExpression operand)
SqlExpression ReferenceExpression
virtual SqlExpression Visit(SqlExpression expression)
Visits a given SQL expression.