25 namespace Deveel.Data.Sql.Statements {
28 if (queryExpression == null)
29 throw new ArgumentNullException(
"queryExpression");
30 if (reference == null)
31 throw new ArgumentNullException(
"reference");
33 QueryExpression = queryExpression;
41 public bool IsVariableReference {
45 public bool IsObjectReference {
50 var queryPlan = context.
Query.
Context.QueryPlanner().PlanQuery(
new QueryInfo(context, QueryExpression));
52 if (IsObjectReference) {
54 return new Prepared(queryPlan, tableRef);
57 if (IsVariableReference) {
58 throw new NotImplementedException();
62 throw new NotSupportedException();
78 VariableName = varName;
82 QueryPlan = queryPlan;
89 VariableName = data.
GetString(
"VariableName");
92 public bool IsForTable {
get;
private set; }
98 public string VariableName {
get;
private set; }
101 data.
SetValue(
"IsForTable", IsForTable);
102 data.
SetValue(
"QueryPlan", QueryPlan);
104 data.
SetValue(
"VariableName", VariableName);
108 var result = QueryPlan.Evaluate(context.
Request);
115 SelectIntoTable(table, result);
120 throw new NotImplementedException();
125 throw new InvalidOperationException();
128 for (
int i = 0; i < result.
RowCount; i++) {
129 var newRow = table.NewRow();
131 for (
int j = 0; j < result.ColumnCount(); j++) {
133 newRow.SetValue(j, value);
147 if (!aCol.ColumnType.IsComparable(bCol.ColumnType))
Defines the contract to access the data contained into a table of a database.
void SelectIntoTable(IMutableTable table, ITable result)
An expression that references an object within a context.
An exception that happens during the SqlStatement.Prepare(IExpressionPreparer, IQueryContext).
bool AreCompatible(TableInfo a, TableInfo b)
void SetValue(string key, Type type, object value)
Describes the name of an object within a database.
Prepared(IQueryPlanNode queryPlan, string varName)
DataObject GetValue(long rowNumber, int columnOffset)
Gets a single cell within the table that is located at the given column offset and row...
SqlExpressionType
All the possible type of SqlExpression supported
A node element of a query plan tree. /summary>
Represents the foundation class of SQL statements to be executed.
SelectIntoStatement(SqlQueryExpression queryExpression, SqlExpression reference)
RowId AddRow(Row row)
Persists a new row to the table.
Prepared(IQueryPlanNode queryPlan, ObjectName table)
TableInfo TableInfo
Gets the metadata information of the table, used to resolve the column sources.
int RowCount
Gets the total number of rows in the table.
override void GetData(SerializeData data)
Prepared(IQueryPlanNode queryPlan)
An expression that references an object on the database (that is a Column, Table, Sequence...
bool GetBoolean(string key)
Prepared(ObjectData data)
int ColumnCount
Gets a count of the columns defined by this object.
object GetValue(string key)
IStatement Prepare(IRequest request)
Defines the base class for instances that represent SQL expression tree nodes.
override void ExecuteStatement(ExecutionContext context)
Defines the metadata properties of a table existing within a database.
new IQueryContext Context
An interface that defines contracts to alter the contents of a table.
string GetString(string key)