18 using System.Collections.Generic;
25 namespace Deveel.Data.Sql.Statements {
28 if (wherExpression == null)
29 throw new ArgumentNullException(
"wherExpression");
30 if (assignments == null)
31 throw new ArgumentNullException(
"assignments");
32 if (String.IsNullOrEmpty(tableName))
33 throw new ArgumentNullException(
"tableName");
35 TableName = tableName;
36 WherExpression = wherExpression;
37 Assignments = assignments;
40 public string TableName {
get;
private set; }
44 public int Limit {
get; set; }
46 public IEnumerable<SqlColumnAssignment> Assignments {
get;
private set; }
49 var tableName = context.
Query.ResolveTableName(TableName);
50 if (!context.
Query.TableExists(tableName))
55 queryExpression.WhereExpression = WherExpression;
58 var queryPlan = context.
Query.
Context.QueryPlanner().PlanQuery(
new QueryInfo(context, queryExpression));
60 var columns =
new List<SqlAssignExpression>();
61 foreach (var assignment
in Assignments) {
64 var refName = queryFrom.ResolveReference(columnName);
65 var expression = assignment.Expression.Prepare(queryFrom.ExpressionPreparer);
71 return new Prepared(tableName, queryPlan, columns.ToArray(), Limit);
79 TableName = tableName;
80 QueryPlan = queryPlan;
98 public int Limit {
get;
private set; }
101 var updateCount = context.
Request.
Query.UpdateTable(TableName, QueryPlan, Columns, Limit);
106 data.
SetValue(
"TableName", TableName);
107 data.
SetValue(
"QueryPlan", QueryPlan);
static ObjectName Parse(string s)
Parses the given string into a ObjectName object.
void AddTable(string alias, FromTable table)
Adds a table as source to the query with a given alias.
void SetValue(string key, Type type, object value)
Describes the name of an object within a database.
override void GetData(SerializeData data)
static SqlAssignExpression Assign(SqlExpression reference, SqlExpression valueExpression)
override void ExecuteStatement(ExecutionContext context)
A node element of a query plan tree. /summary>
Represents the foundation class of SQL statements to be executed.
Prepared(ObjectData data)
static QueryExpressionFrom Create(IRequest context, SqlQueryExpression expression)
static SqlBinaryExpression Add(SqlExpression left, SqlExpression right)
void SetResult(ITable result)
Represents a column selected to be in the output of a select statement.
UpdateStatement(string tableName, SqlExpression wherExpression, IEnumerable< SqlColumnAssignment > assignments)
static SqlReferenceExpression Reference(ObjectName objectName)
object GetValue(string key)
Prepared(ObjectName tableName, IQueryPlanNode queryPlan, SqlAssignExpression[] columns, int limit)
IStatement Prepare(IRequest request)
Defines the base class for instances that represent SQL expression tree nodes.
static SelectColumn Glob(string glob)
Creates a special SelectColumn that is used to select all the columns in a table. ...
new IQueryContext Context