DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Static Public Member Functions | Protected Member Functions | Package Functions | Static Package Functions | Properties | Private Member Functions | Private Attributes | List of all members
Deveel.Data.Sql.Expressions.SqlExpression Class Reference

Defines the base class for instances that represent SQL expression tree nodes. More...

Inheritance diagram for Deveel.Data.Sql.Expressions.SqlExpression:
Deveel.Data.Serialization.ISerializable Deveel.Data.Sql.Expressions.QueryReferenceExpression Deveel.Data.Sql.Expressions.SqlAssignExpression Deveel.Data.Sql.Expressions.SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlCastExpression Deveel.Data.Sql.Expressions.SqlConditionalExpression Deveel.Data.Sql.Expressions.SqlConstantExpression Deveel.Data.Sql.Expressions.SqlFunctionCallExpression Deveel.Data.Sql.Expressions.SqlQueryExpression Deveel.Data.Sql.Expressions.SqlReferenceExpression Deveel.Data.Sql.Expressions.SqlTupleExpression Deveel.Data.Sql.Expressions.SqlUnaryExpression Deveel.Data.Sql.Expressions.SqlVariableReferenceExpression

Public Member Functions

virtual SqlExpression Prepare (IExpressionPreparer preparer)
 
virtual SqlExpression Accept (SqlExpressionVisitor visitor)
 
virtual SqlExpression Evaluate (EvaluateContext context)
 When overridden by a derived class, this method evaluates the expression within the provided context. More...
 
SqlExpression Evaluate ()
 Statically evaluates the expression, outside any context. More...
 
SqlExpression Evaluate (IRequest context, IVariableResolver variables)
 
SqlExpression Evaluate (IRequest context, IVariableResolver variables, IGroupResolver group)
 
override string ToString ()
 

Static Public Member Functions

static SqlExpression Parse (string s)
 Parses the given SQL string to an expression that can be evaluated. More...
 
static SqlExpression Parse (string s, ISystemContext context)
 Parses the given SQL string to an expression that can be evaluated. More...
 
static SqlConstantExpression Constant (object value)
 
static SqlConstantExpression Constant (DataObject value)
 
static SqlCastExpression Cast (SqlExpression value, SqlType destType)
 
static SqlFunctionCallExpression FunctionCall (ObjectName functionName)
 
static SqlFunctionCallExpression FunctionCall (ObjectName functionName, SqlExpression[] args)
 
static SqlFunctionCallExpression FunctionCall (string functionName)
 
static SqlFunctionCallExpression FunctionCall (string functionName, SqlExpression[] args)
 
static SqlReferenceExpression Reference (ObjectName objectName)
 
static SqlVariableReferenceExpression VariableReference (string varName)
 
static SqlConditionalExpression Conditional (SqlExpression testExpression, SqlExpression ifTrue)
 
static SqlConditionalExpression Conditional (SqlExpression testExpression, SqlExpression ifTrue, SqlExpression ifFalse)
 
static SqlBinaryExpression Binary (SqlExpression left, SqlExpressionType expressionType, SqlExpression right)
 
static SqlBinaryExpression Equal (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression NotEqual (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression Is (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression IsNot (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression SmallerOrEqualThan (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression GreaterOrEqualThan (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression SmallerThan (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression GreaterThan (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression Like (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression NotLike (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression And (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression Or (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression XOr (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression Add (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression Subtract (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression Multiply (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression Divide (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression Modulo (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression Any (SqlExpression left, SqlExpressionType anyType, SqlExpression right)
 
static SqlBinaryExpression AnyEqual (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression AnyNotEqual (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression AnyGreaterThan (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression AnyGreaterOrEqualThan (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression AnySmallerThan (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression AnySmallerOrEqualThan (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression All (SqlExpression left, SqlExpressionType allType, SqlExpression right)
 
static SqlBinaryExpression AllEqual (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression AllNotEqual (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression AllGreaterThan (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression AllGreaterOrEqualThan (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression AllSmallerThan (SqlExpression left, SqlExpression right)
 
static SqlBinaryExpression AllSmallerOrEqualThan (SqlExpression left, SqlExpression right)
 
static SqlUnaryExpression Unary (SqlExpressionType expressionType, SqlExpression operand)
 
static SqlUnaryExpression Not (SqlExpression operand)
 
static SqlUnaryExpression Negate (SqlExpression operand)
 
static SqlUnaryExpression UnaryPlus (SqlExpression operand)
 
static SqlAssignExpression Assign (SqlExpression reference, SqlExpression valueExpression)
 
static SqlTupleExpression Tuple (SqlExpression[] expressions)
 
static SqlTupleExpression Tuple (SqlExpression expr1, SqlExpression exp2)
 
static SqlTupleExpression Tuple (SqlExpression expr1, SqlExpression expr2, SqlExpression expr3)
 

Protected Member Functions

virtual void GetData (SerializeData data)
 

Package Functions

 SqlExpression ()
 Internally constructs the SQL expression, avoiding external implementations to be allowed to inherit this class. More...
 
 SqlExpression (ObjectData data)
 

Static Package Functions

static void Serialize (SqlExpression expression, BinaryWriter writer)
 
static SqlExpression Deserialize (BinaryReader reader)
 

Properties

abstract SqlExpressionType ExpressionType [get]
 Gets the type code of this SQL expression. More...
 
virtual bool CanEvaluate [get]
 Gets a value indicating whether the expression can be evaluated to another simpler one. More...
 
int EvaluatePrecedence [get, set]
 

Private Member Functions

void ISerializable. GetData (SerializeData data)
 

Private Attributes

int precedence
 

Detailed Description

Defines the base class for instances that represent SQL expression tree nodes.

The architecture of the SQL Expression domain is to keep the implementation internal to the project, that means it will be possible to construct expressions only through this class, calling factory methods (for example Binary).

Definition at line 35 of file SqlExpression.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Expressions.SqlExpression.SqlExpression ( )
inlinepackage

Internally constructs the SQL expression, avoiding external implementations to be allowed to inherit this class.

Definition at line 42 of file SqlExpression.cs.

42  {
43  }
Deveel.Data.Sql.Expressions.SqlExpression.SqlExpression ( ObjectData  data)
inlinepackage

Definition at line 45 of file SqlExpression.cs.

45  {
46  }

Member Function Documentation

virtual SqlExpression Deveel.Data.Sql.Expressions.SqlExpression.Accept ( SqlExpressionVisitor  visitor)
inlinevirtual

Definition at line 137 of file SqlExpression.cs.

137  {
138  return visitor.Visit(this);
139  }
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Add ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 405 of file SqlExpression.cs.

405  {
406  return new SqlBinaryExpression(left, SqlExpressionType.Add, right);
407  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.All ( SqlExpression  left,
SqlExpressionType  allType,
SqlExpression  right 
)
inlinestatic

Definition at line 472 of file SqlExpression.cs.

472  {
473  if (allType == SqlExpressionType.Equal ||
474  allType == SqlExpressionType.AllEqual)
475  return AllEqual(left, right);
476  if (allType == SqlExpressionType.NotEqual ||
477  allType == SqlExpressionType.AllNotEqual)
478  return AllNotEqual(left, right);
479  if (allType == SqlExpressionType.GreaterThan ||
480  allType == SqlExpressionType.AllGreaterThan)
481  return AllGreaterThan(left, right);
482  if (allType == SqlExpressionType.SmallerThan ||
483  allType == SqlExpressionType.AllSmallerThan)
484  return AllSmallerThan(left, right);
485  if (allType == SqlExpressionType.GreaterOrEqualThan ||
486  allType == SqlExpressionType.AllGreaterOrEqualThan)
487  return AllGreaterOrEqualThan(left, right);
488  if (allType == SqlExpressionType.SmallerOrEqualThan ||
489  allType == SqlExpressionType.AllSmallerOrEqualThan)
490  return AllSmallerOrEqualThan(left, right);
491 
492  throw new ArgumentException(String.Format("The type '{0}' cannot be part of an ALL operator.", allType));
493  }
static SqlBinaryExpression AllGreaterThan(SqlExpression left, SqlExpression right)
A long string in the system.
static SqlBinaryExpression AllSmallerThan(SqlExpression left, SqlExpression right)
static SqlBinaryExpression AllGreaterOrEqualThan(SqlExpression left, SqlExpression right)
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression AllSmallerOrEqualThan(SqlExpression left, SqlExpression right)
static SqlBinaryExpression AllEqual(SqlExpression left, SqlExpression right)
static SqlBinaryExpression AllNotEqual(SqlExpression left, SqlExpression right)
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.AllEqual ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 495 of file SqlExpression.cs.

495  {
496  return new SqlBinaryExpression(left, SqlExpressionType.AllEqual, right);
497  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.AllGreaterOrEqualThan ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 507 of file SqlExpression.cs.

507  {
508  return new SqlBinaryExpression(left, SqlExpressionType.AllGreaterOrEqualThan, right);
509  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.AllGreaterThan ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 503 of file SqlExpression.cs.

503  {
504  return new SqlBinaryExpression(left, SqlExpressionType.AllGreaterThan, right);
505  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.AllNotEqual ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 499 of file SqlExpression.cs.

499  {
500  return new SqlBinaryExpression(left, SqlExpressionType.AllNotEqual, right);
501  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.AllSmallerOrEqualThan ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 515 of file SqlExpression.cs.

515  {
516  return new SqlBinaryExpression(left, SqlExpressionType.AllSmallerOrEqualThan, right);
517  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.AllSmallerThan ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 511 of file SqlExpression.cs.

511  {
512  return new SqlBinaryExpression(left, SqlExpressionType.AllSmallerThan, right);
513  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.And ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 393 of file SqlExpression.cs.

393  {
394  return new SqlBinaryExpression(left, SqlExpressionType.And, right);
395  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Any ( SqlExpression  left,
SqlExpressionType  anyType,
SqlExpression  right 
)
inlinestatic

Definition at line 425 of file SqlExpression.cs.

425  {
426  if (anyType == SqlExpressionType.Equal ||
427  anyType == SqlExpressionType.AnyEqual)
428  return AnyEqual(left, right);
429  if (anyType == SqlExpressionType.NotEqual ||
430  anyType == SqlExpressionType.AnyNotEqual)
431  return AnyNotEqual(left, right);
432  if (anyType == SqlExpressionType.AnyGreaterThan ||
433  anyType == SqlExpressionType.GreaterThan)
434  return AnyGreaterThan(left, right);
435  if (anyType == SqlExpressionType.SmallerThan ||
436  anyType == SqlExpressionType.AnySmallerThan)
437  return AnySmallerThan(left, right);
438  if (anyType == SqlExpressionType.GreaterOrEqualThan ||
439  anyType == SqlExpressionType.AnyGreaterOrEqualThan)
440  return AnyGreaterOrEqualThan(left, right);
441  if (anyType == SqlExpressionType.GreaterOrEqualThan ||
442  anyType == SqlExpressionType.AnySmallerOrEqualThan)
443  return AnySmallerOrEqualThan(left, right);
444 
445  throw new ArgumentException(String.Format("The type '{0}' cannot be part of an ANY operator.", anyType));
446  }
A long string in the system.
static SqlBinaryExpression AnySmallerThan(SqlExpression left, SqlExpression right)
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression AnyEqual(SqlExpression left, SqlExpression right)
static SqlBinaryExpression AnyNotEqual(SqlExpression left, SqlExpression right)
static SqlBinaryExpression AnyGreaterThan(SqlExpression left, SqlExpression right)
static SqlBinaryExpression AnyGreaterOrEqualThan(SqlExpression left, SqlExpression right)
static SqlBinaryExpression AnySmallerOrEqualThan(SqlExpression left, SqlExpression right)
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.AnyEqual ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 448 of file SqlExpression.cs.

448  {
449  return new SqlBinaryExpression(left, SqlExpressionType.AnyEqual, right);
450  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.AnyGreaterOrEqualThan ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 460 of file SqlExpression.cs.

460  {
461  return new SqlBinaryExpression(left, SqlExpressionType.AnyGreaterOrEqualThan, right);
462  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.AnyGreaterThan ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 456 of file SqlExpression.cs.

456  {
457  return new SqlBinaryExpression(left, SqlExpressionType.AnyGreaterThan, right);
458  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.AnyNotEqual ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 452 of file SqlExpression.cs.

452  {
453  return new SqlBinaryExpression(left, SqlExpressionType.AnyNotEqual, right);
454  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.AnySmallerOrEqualThan ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 468 of file SqlExpression.cs.

468  {
469  return new SqlBinaryExpression(left, SqlExpressionType.AnySmallerOrEqualThan, right);
470  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.AnySmallerThan ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 464 of file SqlExpression.cs.

464  {
465  return new SqlBinaryExpression(left, SqlExpressionType.AnySmallerThan, right);
466  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlAssignExpression Deveel.Data.Sql.Expressions.SqlExpression.Assign ( SqlExpression  reference,
SqlExpression  valueExpression 
)
inlinestatic

Definition at line 548 of file SqlExpression.cs.

548  {
549  return new SqlAssignExpression(reference, valueExpression);
550  }
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Binary ( SqlExpression  left,
SqlExpressionType  expressionType,
SqlExpression  right 
)
inlinestatic

Definition at line 304 of file SqlExpression.cs.

304  {
305  if (expressionType == SqlExpressionType.Add)
306  return Add(left, right);
307  if (expressionType == SqlExpressionType.Subtract)
308  return Subtract(left, right);
309  if (expressionType == SqlExpressionType.Multiply)
310  return Multiply(left, right);
311  if (expressionType == SqlExpressionType.Divide)
312  return Divide(left, right);
313  if (expressionType == SqlExpressionType.Modulo)
314  return Modulo(left, right);
315 
316  if (expressionType == SqlExpressionType.Equal)
317  return Equal(left, right);
318  if (expressionType == SqlExpressionType.NotEqual)
319  return NotEqual(left, right);
320  if (expressionType == SqlExpressionType.Is)
321  return Is(left, right);
322  if (expressionType == SqlExpressionType.IsNot)
323  return IsNot(left, right);
324  if (expressionType == SqlExpressionType.GreaterThan)
325  return GreaterThan(left, right);
326  if (expressionType == SqlExpressionType.GreaterOrEqualThan)
327  return GreaterOrEqualThan(left, right);
328  if (expressionType == SqlExpressionType.SmallerThan)
329  return SmallerThan(left, right);
330  if (expressionType == SqlExpressionType.SmallerOrEqualThan)
331  return SmallerOrEqualThan(left, right);
332 
333  if (expressionType == SqlExpressionType.Like)
334  return Like(left, right);
335  if (expressionType == SqlExpressionType.NotLike)
336  return NotLike(left, right);
337 
338  if (expressionType == SqlExpressionType.And)
339  return And(left, right);
340  if (expressionType == SqlExpressionType.Or)
341  return Or(left, right);
342  if (expressionType == SqlExpressionType.XOr)
343  return XOr(left, right);
344 
345  if (expressionType.IsAny())
346  return Any(left, expressionType.SubQueryPlainType(), right);
347  if (expressionType.IsAll())
348  return All(left, expressionType.SubQueryPlainType(), right);
349 
350  throw new ArgumentException(String.Format("Expression type {0} is not a Binary", expressionType));
351  }
static SqlBinaryExpression Divide(SqlExpression left, SqlExpression right)
static SqlBinaryExpression All(SqlExpression left, SqlExpressionType allType, SqlExpression right)
A long string in the system.
static SqlBinaryExpression And(SqlExpression left, SqlExpression right)
static SqlBinaryExpression SmallerOrEqualThan(SqlExpression left, SqlExpression right)
static SqlBinaryExpression Multiply(SqlExpression left, SqlExpression right)
static SqlBinaryExpression Equal(SqlExpression left, SqlExpression right)
static SqlBinaryExpression SmallerThan(SqlExpression left, SqlExpression right)
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Modulo(SqlExpression left, SqlExpression right)
static SqlBinaryExpression Add(SqlExpression left, SqlExpression right)
static SqlBinaryExpression Or(SqlExpression left, SqlExpression right)
static SqlBinaryExpression IsNot(SqlExpression left, SqlExpression right)
static SqlBinaryExpression NotEqual(SqlExpression left, SqlExpression right)
static SqlBinaryExpression XOr(SqlExpression left, SqlExpression right)
static SqlBinaryExpression Subtract(SqlExpression left, SqlExpression right)
static SqlBinaryExpression Like(SqlExpression left, SqlExpression right)
static SqlBinaryExpression Any(SqlExpression left, SqlExpressionType anyType, SqlExpression right)
static SqlBinaryExpression NotLike(SqlExpression left, SqlExpression right)
static SqlBinaryExpression GreaterThan(SqlExpression left, SqlExpression right)
static SqlBinaryExpression GreaterOrEqualThan(SqlExpression left, SqlExpression right)
static SqlBinaryExpression Is(SqlExpression left, SqlExpression right)
static SqlCastExpression Deveel.Data.Sql.Expressions.SqlExpression.Cast ( SqlExpression  value,
SqlType  destType 
)
inlinestatic

Definition at line 264 of file SqlExpression.cs.

264  {
265  return new SqlCastExpression(value, destType);
266  }
static SqlConditionalExpression Deveel.Data.Sql.Expressions.SqlExpression.Conditional ( SqlExpression  testExpression,
SqlExpression  ifTrue 
)
inlinestatic

Definition at line 294 of file SqlExpression.cs.

294  {
295  return Conditional(testExpression, ifTrue, null);
296  }
static SqlConditionalExpression Conditional(SqlExpression testExpression, SqlExpression ifTrue)
static SqlConditionalExpression Deveel.Data.Sql.Expressions.SqlExpression.Conditional ( SqlExpression  testExpression,
SqlExpression  ifTrue,
SqlExpression  ifFalse 
)
inlinestatic

Definition at line 298 of file SqlExpression.cs.

298  {
299  return new SqlConditionalExpression(testExpression, ifTrue, ifFalse);
300  }
static SqlConstantExpression Deveel.Data.Sql.Expressions.SqlExpression.Constant ( object  value)
inlinestatic

Definition at line 256 of file SqlExpression.cs.

256  {
257  return Constant(DataObject.Create(value));
258  }
static SqlConstantExpression Constant(object value)
static SqlConstantExpression Deveel.Data.Sql.Expressions.SqlExpression.Constant ( DataObject  value)
inlinestatic

Definition at line 260 of file SqlExpression.cs.

260  {
261  return new SqlConstantExpression(value);
262  }
static SqlExpression Deveel.Data.Sql.Expressions.SqlExpression.Deserialize ( BinaryReader  reader)
inlinestaticpackage

Definition at line 572 of file SqlExpression.cs.

572  {
573  var serializer = new BinarySerializer();
574  return (SqlExpression) serializer.Deserialize(reader, typeof(SqlExpression));
575  }
SqlExpression()
Internally constructs the SQL expression, avoiding external implementations to be allowed to inherit ...
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Divide ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 417 of file SqlExpression.cs.

417  {
418  return new SqlBinaryExpression(left, SqlExpressionType.Divide, right);
419  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Equal ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 353 of file SqlExpression.cs.

353  {
354  return new SqlBinaryExpression(left, SqlExpressionType.Equal, right);
355  }
SqlExpressionType
All the possible type of SqlExpression supported
virtual SqlExpression Deveel.Data.Sql.Expressions.SqlExpression.Evaluate ( EvaluateContext  context)
inlinevirtual

When overridden by a derived class, this method evaluates the expression within the provided context.

Parameters
contextThe context for the evaluation of the expression, providing access to the system or to the execution context.

This method is only executed is CanEvaluate is true, and the override method can reduce this expression to a simpler form.

Returns
Returns a new
See also
SqlExpression
that is the result of the evaluation of this expression, within the context given.
Exceptions
ExpressionEvaluateExceptionIf any error occurred while evaluating the expression.

Definition at line 167 of file SqlExpression.cs.

167  {
168  var visitor = new ExpressionEvaluatorVisitor(context);
169  return visitor.Visit(this);
170  }
SqlExpression Deveel.Data.Sql.Expressions.SqlExpression.Evaluate ( )
inline

Statically evaluates the expression, outside any context.

This overload of the Evaluate logic provides an empty context to Evaluate(EvaluateContext), so that dynamic resolutions (eg. function calls, states assessments, etc.) will throw an exception.

Care must be taken when calling this method, that the expression tree represented does not contain any reference to dynamically resolved expressions (SqlFunctionCallExpression for example), otherwise its evaluation will result in an exception state.

Returns
Returns a new
See also
SqlExpression
that is the result of the static evaluation of this expression.
Exceptions
ExpressionEvaluateExceptionIf any error occurred while evaluating the expression.

Definition at line 194 of file SqlExpression.cs.

194  {
195  return Evaluate(null, null);
196  }
SqlExpression Evaluate()
Statically evaluates the expression, outside any context.
SqlExpression Deveel.Data.Sql.Expressions.SqlExpression.Evaluate ( IRequest  context,
IVariableResolver  variables 
)
inline

Definition at line 198 of file SqlExpression.cs.

198  {
199  return Evaluate(context, variables, null);
200  }
SqlExpression Evaluate()
Statically evaluates the expression, outside any context.
SqlExpression Deveel.Data.Sql.Expressions.SqlExpression.Evaluate ( IRequest  context,
IVariableResolver  variables,
IGroupResolver  group 
)
inline

Definition at line 202 of file SqlExpression.cs.

202  {
203  return Evaluate(new EvaluateContext(context, variables, group));
204  }
SqlExpression Evaluate()
Statically evaluates the expression, outside any context.
static SqlFunctionCallExpression Deveel.Data.Sql.Expressions.SqlExpression.FunctionCall ( ObjectName  functionName)
inlinestatic

Definition at line 268 of file SqlExpression.cs.

268  {
269  return FunctionCall(functionName, new SqlExpression[0]);
270  }
SqlExpression()
Internally constructs the SQL expression, avoiding external implementations to be allowed to inherit ...
static SqlFunctionCallExpression FunctionCall(ObjectName functionName)
static SqlFunctionCallExpression Deveel.Data.Sql.Expressions.SqlExpression.FunctionCall ( ObjectName  functionName,
SqlExpression[]  args 
)
inlinestatic

Definition at line 272 of file SqlExpression.cs.

272  {
273  return new SqlFunctionCallExpression(functionName, args);
274  }
static SqlFunctionCallExpression Deveel.Data.Sql.Expressions.SqlExpression.FunctionCall ( string  functionName)
inlinestatic

Definition at line 276 of file SqlExpression.cs.

276  {
277  return FunctionCall(functionName, new SqlExpression[0]);
278  }
SqlExpression()
Internally constructs the SQL expression, avoiding external implementations to be allowed to inherit ...
static SqlFunctionCallExpression FunctionCall(ObjectName functionName)
static SqlFunctionCallExpression Deveel.Data.Sql.Expressions.SqlExpression.FunctionCall ( string  functionName,
SqlExpression[]  args 
)
inlinestatic

Definition at line 280 of file SqlExpression.cs.

280  {
281  return FunctionCall(ObjectName.Parse(functionName), args);
282  }
static SqlFunctionCallExpression FunctionCall(ObjectName functionName)
void ISerializable. Deveel.Data.Sql.Expressions.SqlExpression.GetData ( SerializeData  data)
inlineprivate

Implements Deveel.Data.Serialization.ISerializable.

Definition at line 141 of file SqlExpression.cs.

141  {
142  GetData(data);
143  }
void ISerializable. GetData(SerializeData data)
virtual void Deveel.Data.Sql.Expressions.SqlExpression.GetData ( SerializeData  data)
inlineprotectedvirtual
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.GreaterOrEqualThan ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 373 of file SqlExpression.cs.

373  {
374  return new SqlBinaryExpression(left, SqlExpressionType.GreaterOrEqualThan, right);
375  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.GreaterThan ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 381 of file SqlExpression.cs.

381  {
382  return new SqlBinaryExpression(left, SqlExpressionType.GreaterThan, right);
383  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Is ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 361 of file SqlExpression.cs.

361  {
362  return new SqlBinaryExpression(left, SqlExpressionType.Is, right);
363  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.IsNot ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 365 of file SqlExpression.cs.

365  {
366  return new SqlBinaryExpression(left, SqlExpressionType.IsNot, right);
367  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Like ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 385 of file SqlExpression.cs.

385  {
386  return new SqlBinaryExpression(left, SqlExpressionType.Like, right);
387  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Modulo ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 421 of file SqlExpression.cs.

421  {
422  return new SqlBinaryExpression(left, SqlExpressionType.Modulo, right);
423  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Multiply ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 413 of file SqlExpression.cs.

413  {
414  return new SqlBinaryExpression(left, SqlExpressionType.Multiply, right);
415  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlUnaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Negate ( SqlExpression  operand)
inlinestatic

Definition at line 538 of file SqlExpression.cs.

538  {
539  return new SqlUnaryExpression(SqlExpressionType.Negate, operand);
540  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlUnaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Not ( SqlExpression  operand)
inlinestatic

Definition at line 534 of file SqlExpression.cs.

534  {
535  return new SqlUnaryExpression(SqlExpressionType.Not, operand);
536  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.NotEqual ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 357 of file SqlExpression.cs.

357  {
358  return new SqlBinaryExpression(left, SqlExpressionType.NotEqual, right);
359  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.NotLike ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 389 of file SqlExpression.cs.

389  {
390  return new SqlBinaryExpression(left, SqlExpressionType.NotLike, right);
391  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Or ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 397 of file SqlExpression.cs.

397  {
398  return new SqlBinaryExpression(left, SqlExpressionType.Or, right);
399  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlExpression Deveel.Data.Sql.Expressions.SqlExpression.Parse ( string  s)
inlinestatic

Parses the given SQL string to an expression that can be evaluated.

Parameters
sThe string to parse.
Returns
Returns an instance of
See also
SqlExpression
that represents the given SQL string parsed.

Definition at line 219 of file SqlExpression.cs.

219  {
220  return Parse(s, null);
221  }
static SqlExpression Parse(string s)
Parses the given SQL string to an expression that can be evaluated.
static SqlExpression Deveel.Data.Sql.Expressions.SqlExpression.Parse ( string  s,
ISystemContext  context 
)
inlinestatic

Parses the given SQL string to an expression that can be evaluated.

Parameters
sThe string to parse.
context
Returns
Returns an instance of
See also
SqlExpression
that represents the given SQL string parsed.

Definition at line 232 of file SqlExpression.cs.

232  {
233  try {
234  // TODO: Get the expression compiler from the context
235  var compiler = SqlParsers.Expression;
236  var result = compiler.Parse(s);
237 
238  if (result.HasErrors)
239  throw new SqlParseException();
240 
241  var expNode = result.RootNode as IExpressionNode;
242  if (expNode == null)
243  throw new SqlExpressionException(ExpressionErrorCodes.CannotParse, "The parse of the text did not result into an expression.");
244 
245  return ExpressionBuilder.Build(expNode);
246  } catch (SqlParseException ex) {
247  throw new SqlExpressionException(ExpressionErrorCodes.CannotParse,
248  "Could not parse input expression: see inner exception for details.", ex);
249  }
250  }
static SqlExpression Build(IExpressionNode node)
static readonly ISqlParser Expression
Definition: SqlParsers.cs:21
ExpressionErrorCodes
Lists all the codes of errors in the expressions domain
SqlParseResult Parse(string input)
Analyzes and parses the input and results an object that describes the parsed nodes in a tree that ca...
An error that occurs when compiling a input string into a SQL object.
This interface acts like a marker that indicates if a ISqlNode represents a SQL expression.
virtual SqlExpression Deveel.Data.Sql.Expressions.SqlExpression.Prepare ( IExpressionPreparer  preparer)
inlinevirtual

Definition at line 132 of file SqlExpression.cs.

132  {
133  var visitor = new PreparerVisitor(preparer);
134  return visitor.Visit(this);
135  }
static SqlReferenceExpression Deveel.Data.Sql.Expressions.SqlExpression.Reference ( ObjectName  objectName)
inlinestatic

Definition at line 284 of file SqlExpression.cs.

284  {
285  return new SqlReferenceExpression(objectName);
286  }
static void Deveel.Data.Sql.Expressions.SqlExpression.Serialize ( SqlExpression  expression,
BinaryWriter  writer 
)
inlinestaticpackage

Definition at line 567 of file SqlExpression.cs.

567  {
568  var serializer = new BinarySerializer();
569  serializer.Serialize(writer, expression);
570  }
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.SmallerOrEqualThan ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 369 of file SqlExpression.cs.

369  {
370  return new SqlBinaryExpression(left, SqlExpressionType.SmallerOrEqualThan, right);
371  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.SmallerThan ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 377 of file SqlExpression.cs.

377  {
378  return new SqlBinaryExpression(left, SqlExpressionType.SmallerThan, right);
379  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Subtract ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 409 of file SqlExpression.cs.

409  {
410  return new SqlBinaryExpression(left, SqlExpressionType.Subtract, right);
411  }
SqlExpressionType
All the possible type of SqlExpression supported
override string Deveel.Data.Sql.Expressions.SqlExpression.ToString ( )
inline

Definition at line 206 of file SqlExpression.cs.

206  {
207  var builder = new ExpressionStringBuilder();
208  return builder.ToSqlString(this);
209  }
static SqlTupleExpression Deveel.Data.Sql.Expressions.SqlExpression.Tuple ( SqlExpression[]  expressions)
inlinestatic

Definition at line 553 of file SqlExpression.cs.

553  {
554  return new SqlTupleExpression(expressions);
555  }
static SqlTupleExpression Deveel.Data.Sql.Expressions.SqlExpression.Tuple ( SqlExpression  expr1,
SqlExpression  exp2 
)
inlinestatic

Definition at line 557 of file SqlExpression.cs.

557  {
558  return Tuple(new[] {expr1, exp2});
559  }
static SqlTupleExpression Tuple(SqlExpression[] expressions)
static SqlTupleExpression Deveel.Data.Sql.Expressions.SqlExpression.Tuple ( SqlExpression  expr1,
SqlExpression  expr2,
SqlExpression  expr3 
)
inlinestatic

Definition at line 561 of file SqlExpression.cs.

561  {
562  return Tuple(new[] {expr1, expr2, expr3});
563  }
static SqlTupleExpression Tuple(SqlExpression[] expressions)
static SqlUnaryExpression Deveel.Data.Sql.Expressions.SqlExpression.Unary ( SqlExpressionType  expressionType,
SqlExpression  operand 
)
inlinestatic

Definition at line 523 of file SqlExpression.cs.

523  {
524  if (expressionType == SqlExpressionType.UnaryPlus)
525  return UnaryPlus(operand);
526  if (expressionType == SqlExpressionType.Negate)
527  return Negate(operand);
528  if (expressionType == SqlExpressionType.Not)
529  return Not(operand);
530 
531  throw new ArgumentException(String.Format("Expression Type {0} is not an Unary.", expressionType));
532  }
A long string in the system.
static SqlUnaryExpression Not(SqlExpression operand)
SqlExpressionType
All the possible type of SqlExpression supported
static SqlUnaryExpression UnaryPlus(SqlExpression operand)
static SqlUnaryExpression Negate(SqlExpression operand)
static SqlUnaryExpression Deveel.Data.Sql.Expressions.SqlExpression.UnaryPlus ( SqlExpression  operand)
inlinestatic

Definition at line 542 of file SqlExpression.cs.

542  {
543  return new SqlUnaryExpression(SqlExpressionType.UnaryPlus, operand);
544  }
SqlExpressionType
All the possible type of SqlExpression supported
static SqlVariableReferenceExpression Deveel.Data.Sql.Expressions.SqlExpression.VariableReference ( string  varName)
inlinestatic

Definition at line 288 of file SqlExpression.cs.

288  {
289  return new SqlVariableReferenceExpression(varName);
290  }
static SqlBinaryExpression Deveel.Data.Sql.Expressions.SqlExpression.XOr ( SqlExpression  left,
SqlExpression  right 
)
inlinestatic

Definition at line 401 of file SqlExpression.cs.

401  {
402  return new SqlBinaryExpression(left, SqlExpressionType.XOr, right);
403  }
SqlExpressionType
All the possible type of SqlExpression supported

Member Data Documentation

int Deveel.Data.Sql.Expressions.SqlExpression.precedence
private

Definition at line 36 of file SqlExpression.cs.

Property Documentation

virtual bool Deveel.Data.Sql.Expressions.SqlExpression.CanEvaluate
get

Gets a value indicating whether the expression can be evaluated to another simpler one.

See also
Evaluate(EvaluateContext)

Definition at line 58 of file SqlExpression.cs.

int Deveel.Data.Sql.Expressions.SqlExpression.EvaluatePrecedence
getsetpackage

Definition at line 62 of file SqlExpression.cs.

abstract SqlExpressionType Deveel.Data.Sql.Expressions.SqlExpression.ExpressionType
get

Gets the type code of this SQL expression.

Definition at line 51 of file SqlExpression.cs.


The documentation for this class was generated from the following file: