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.Statements.OpenStatement Class Reference
Inheritance diagram for Deveel.Data.Sql.Statements.OpenStatement:
Deveel.Data.Sql.Statements.SqlStatement Deveel.Data.Sql.Expressions.IPreparable Deveel.Data.Sql.Statements.IPreparableStatement Deveel.Data.Sql.Statements.IStatement Deveel.Data.Serialization.ISerializable Deveel.Data.Sql.Statements.IStatement Deveel.Data.Sql.IExecutable Deveel.Data.Sql.IExecutable

Public Member Functions

 OpenStatement (string cursorName)
 
 OpenStatement (string cursorName, SqlExpression[] arguments)
 
- Public Member Functions inherited from Deveel.Data.Sql.Statements.SqlStatement
ITable Execute (IRequest context)
 Prepares and evaluates this statement into a tabular result. More...
 

Protected Member Functions

override void GetData (SerializeData data)
 
override void ExecuteStatement (ExecutionContext context)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Statements.SqlStatement
 SqlStatement ()
 
 SqlStatement (ObjectData data)
 

Properties

string CursorName [get, private set]
 
SqlExpression[] Arguments [get, set]
 
- Properties inherited from Deveel.Data.Sql.Statements.SqlStatement
SqlQuery SourceQuery [get, set]
 Gets the SqlQuery that is the origin of this statement. More...
 
bool IsFromQuery [get, private set]
 Gets a boolean value indicating if this object was formed from the parsing of a SqlQuery or if it was manually created. More...
 
- Properties inherited from Deveel.Data.Sql.Statements.IStatement
SqlQuery SourceQuery [get]
 

Private Member Functions

 OpenStatement (ObjectData data)
 
object IPreparable. Prepare (IExpressionPreparer preparer)
 Converts the underlying value of this instance into an object that can be evaluated by an expression. More...
 
IStatement IPreparableStatement. Prepare (IRequest context)
 

Additional Inherited Members

- Static Public Member Functions inherited from Deveel.Data.Sql.Statements.SqlStatement
static IEnumerable< SqlStatementParse (string sqlSource)
 Parses a given string into one of more statements. More...
 
static IEnumerable< SqlStatementParse (IContext context, string sqlSource)
 Parses a given string into one of more statements. More...
 
static IEnumerable< SqlStatementParse (IContext context, SqlQuery query)
 
- Package Functions inherited from Deveel.Data.Sql.Statements.SqlStatement
void SetSource (SqlQuery query)
 

Detailed Description

Definition at line 26 of file OpenStatement.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Statements.OpenStatement.OpenStatement ( string  cursorName)
inline

Definition at line 27 of file OpenStatement.cs.

28  : this(cursorName, new SqlExpression[] {}) {
29  }
Defines the base class for instances that represent SQL expression tree nodes.
Deveel.Data.Sql.Statements.OpenStatement.OpenStatement ( string  cursorName,
SqlExpression[]  arguments 
)
inline

Definition at line 31 of file OpenStatement.cs.

31  {
32  CursorName = cursorName;
33  Arguments = arguments;
34  }
Deveel.Data.Sql.Statements.OpenStatement.OpenStatement ( ObjectData  data)
inlineprivate

Definition at line 36 of file OpenStatement.cs.

36  {
37  CursorName = data.GetString("CursorName");
38  Arguments = data.GetValue<SqlExpression[]>("Arguments");
39  }
Defines the base class for instances that represent SQL expression tree nodes.

Member Function Documentation

override void Deveel.Data.Sql.Statements.OpenStatement.ExecuteStatement ( ExecutionContext  context)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Statements.SqlStatement.

Definition at line 83 of file OpenStatement.cs.

83  {
84  var cursor = context.Request.Query.FindCursor(CursorName);
85  if (cursor == null)
86  throw new StatementException(String.Format("Cursor '{0}' was not found in the context.", CursorName));
87 
88  cursor.Open(context.Request, Arguments);
89  }
A long string in the system.
override void Deveel.Data.Sql.Statements.OpenStatement.GetData ( SerializeData  data)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Statements.SqlStatement.

Definition at line 78 of file OpenStatement.cs.

78  {
79  data.SetValue("CursorName", CursorName);
80  data.SetValue("Arguments", Arguments);
81  }
void SetValue(string key, Type type, object value)
object IPreparable. Deveel.Data.Sql.Statements.OpenStatement.Prepare ( IExpressionPreparer  preparer)
inlineprivate

Converts the underlying value of this instance into an object that can be evaluated by an expression.

Parameters
preparerThe context used to prepare this object.
Returns
Returns an object that can be evaluated by an expression.

Implements Deveel.Data.Sql.Expressions.IPreparable.

Definition at line 45 of file OpenStatement.cs.

45  {
46  SqlExpression[] args = null;
47  if (Arguments != null) {
48  args = (SqlExpression[])Arguments.Clone();
49 
50  for (int i = 0; i < args.Length; i++) {
51  args[i] = args[i].Prepare(preparer);
52  }
53  }
54 
55  return new OpenStatement(CursorName, args);
56  }
virtual SqlExpression Prepare(IExpressionPreparer preparer)
Defines the base class for instances that represent SQL expression tree nodes.
IStatement IPreparableStatement. Deveel.Data.Sql.Statements.OpenStatement.Prepare ( IRequest  context)
inlineprivate

Implements Deveel.Data.Sql.Statements.IPreparableStatement.

Definition at line 58 of file OpenStatement.cs.

58  {
59  SqlExpression[] args = Arguments;
60 
61  var cursor = context.Query.FindCursor(CursorName);
62  if (cursor == null)
63  throw new StatementPrepareException(String.Format("Cursor '{0}' was not found.", CursorName));
64 
65  if (args != null) {
66  var orderedParams = cursor.CursorInfo.Parameters.OrderBy(x => x.Offset).ToArray();
67 
68  if (args.Length != orderedParams.Length)
69  throw new StatementPrepareException(String.Format("Invalid number of arguments for cursor '{0}' OPEN statement.", CursorName));
70 
71  // TODO: Cast to the parameter type here?
72  }
73 
74 
75  return new OpenStatement(CursorName, args);
76  }
A long string in the system.
Defines the base class for instances that represent SQL expression tree nodes.

Property Documentation

SqlExpression [] Deveel.Data.Sql.Statements.OpenStatement.Arguments
getset

Definition at line 43 of file OpenStatement.cs.

string Deveel.Data.Sql.Statements.OpenStatement.CursorName
getprivate set

Definition at line 41 of file OpenStatement.cs.


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