DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Private Attributes | List of all members
Deveel.Data.Sql.Statements.StatementExecutor.QueryPreparer Class Reference
Inheritance diagram for Deveel.Data.Sql.Statements.StatementExecutor.QueryPreparer:
Deveel.Data.Sql.Expressions.IExpressionPreparer

Public Member Functions

 QueryPreparer (SqlQuery query)
 
bool CanPrepare (SqlExpression expression)
 Verifies whether the instance of the interface can prepare the given expression. More...
 
SqlExpression Prepare (SqlExpression expression)
 Returns the new translated object to be mutated from the given expression. More...
 

Private Attributes

readonly SqlQuery query
 

Detailed Description

Definition at line 105 of file StatementExecutor.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Statements.StatementExecutor.QueryPreparer.QueryPreparer ( SqlQuery  query)
inline

Definition at line 108 of file StatementExecutor.cs.

108  {
109  this.query = query;
110  }

Member Function Documentation

bool Deveel.Data.Sql.Statements.StatementExecutor.QueryPreparer.CanPrepare ( SqlExpression  expression)
inline

Verifies whether the instance of the interface can prepare the given expression.

Parameters
expressionThe expression object to verify.
Returns
Returns true if this preparer will prepare the given object in an expression.

Implements Deveel.Data.Sql.Expressions.IExpressionPreparer.

Definition at line 112 of file StatementExecutor.cs.

SqlExpression Deveel.Data.Sql.Statements.StatementExecutor.QueryPreparer.Prepare ( SqlExpression  expression)
inline

Returns the new translated object to be mutated from the given expression.

Parameters
expression
Returns

Implements Deveel.Data.Sql.Expressions.IExpressionPreparer.

Definition at line 116 of file StatementExecutor.cs.

116  {
117  var varRef = (SqlVariableReferenceExpression) expression;
118  var varName = varRef.VariableName;
119 
120  var parameter = query.Parameters.FindParameter(varName);
121  if (parameter == null)
122  return expression;
123 
124  var value = parameter.SqlType.CreateFrom(parameter.Value);
125  var obj = new DataObject(parameter.SqlType, value);
126 
127  return SqlExpression.Constant(obj);
128  }
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
Definition: DataObject.cs:35
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
ICollection< QueryParameter > Parameters
Definition: SqlQuery.cs:53

Member Data Documentation

readonly SqlQuery Deveel.Data.Sql.Statements.StatementExecutor.QueryPreparer.query
private

Definition at line 106 of file StatementExecutor.cs.


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