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

The node for evaluating an expression that contains entirely constant values (no variables). More...

Inheritance diagram for Deveel.Data.Sql.Query.ConstantSelectNode:
Deveel.Data.Sql.Query.SingleQueryPlanNode Deveel.Data.Sql.Query.IQueryPlanNode Deveel.Data.Serialization.ISerializable

Public Member Functions

 ConstantSelectNode (IQueryPlanNode child, SqlExpression expression)
 
override ITable Evaluate (IRequest context)
 

Protected Member Functions

override void GetData (SerializeData data)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Query.SingleQueryPlanNode
 SingleQueryPlanNode (IQueryPlanNode child)
 
 SingleQueryPlanNode (ObjectData data)
 

Properties

SqlExpression Expression [get, private set]
 
- Properties inherited from Deveel.Data.Sql.Query.SingleQueryPlanNode
IQueryPlanNode Child [get, private set]
 Gets the single child node of the plan. More...
 

Private Member Functions

 ConstantSelectNode (ObjectData data)
 

Detailed Description

The node for evaluating an expression that contains entirely constant values (no variables).

Definition at line 30 of file ConstantSelectNode.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Query.ConstantSelectNode.ConstantSelectNode ( IQueryPlanNode  child,
SqlExpression  expression 
)
inline

Definition at line 31 of file ConstantSelectNode.cs.

32  : base(child) {
33  Expression = expression;
34  }
Deveel.Data.Sql.Query.ConstantSelectNode.ConstantSelectNode ( ObjectData  data)
inlineprivate

Definition at line 36 of file ConstantSelectNode.cs.

37  : base(data) {
38  Expression = data.GetValue<SqlExpression>("Expression");
39  }
Defines the base class for instances that represent SQL expression tree nodes.

Member Function Documentation

override ITable Deveel.Data.Sql.Query.ConstantSelectNode.Evaluate ( IRequest  context)
inlinevirtual

Implements Deveel.Data.Sql.Query.SingleQueryPlanNode.

Definition at line 44 of file ConstantSelectNode.cs.

44  {
45  // Evaluate the expression
46  var exp = Expression.Evaluate(context, null);
47  if (exp.ExpressionType != SqlExpressionType.Constant)
48  throw new InvalidOperationException();
49 
50  var v = ((SqlConstantExpression) exp).Value;
51 
52  // If it evaluates to NULL or FALSE then return an empty set
53  if (v.IsNull || v == false)
54  return Child.Evaluate(context).EmptySelect();
55 
56  return Child.Evaluate(context);
57  }
ITable Evaluate(IRequest context)
IQueryPlanNode Child
Gets the single child node of the plan.
SqlExpressionType
All the possible type of SqlExpression supported
virtual SqlExpression Evaluate(EvaluateContext context)
When overridden by a derived class, this method evaluates the expression within the provided context...
An expression that holds a constant value.
override void Deveel.Data.Sql.Query.ConstantSelectNode.GetData ( SerializeData  data)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Query.SingleQueryPlanNode.

Definition at line 59 of file ConstantSelectNode.cs.

59  {
60  data.SetValue("Expression", Expression);
61  }
void SetValue(string key, Type type, object value)

Property Documentation

SqlExpression Deveel.Data.Sql.Query.ConstantSelectNode.Expression
getprivate set

Definition at line 41 of file ConstantSelectNode.cs.


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