DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Classes | Public Member Functions | Properties | Private Member Functions | List of all members
Deveel.Data.Sql.Statements.UpdateStatement Class Reference
Inheritance diagram for Deveel.Data.Sql.Statements.UpdateStatement:
Deveel.Data.Sql.Statements.SqlStatement 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

Classes

class  Prepared
 

Public Member Functions

 UpdateStatement (string tableName, SqlExpression wherExpression, IEnumerable< SqlColumnAssignment > assignments)
 
- Public Member Functions inherited from Deveel.Data.Sql.Statements.SqlStatement
ITable Execute (IRequest context)
 Prepares and evaluates this statement into a tabular result. More...
 

Properties

string TableName [get, private set]
 
SqlExpression WherExpression [get, private set]
 
int Limit [get, set]
 
IEnumerable< SqlColumnAssignmentAssignments [get, private 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

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)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Statements.SqlStatement
 SqlStatement ()
 
 SqlStatement (ObjectData data)
 
virtual void ExecuteStatement (ExecutionContext context)
 
virtual void GetData (SerializeData data)
 
- Package Functions inherited from Deveel.Data.Sql.Statements.SqlStatement
void SetSource (SqlQuery query)
 

Detailed Description

Definition at line 26 of file UpdateStatement.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Statements.UpdateStatement.UpdateStatement ( string  tableName,
SqlExpression  wherExpression,
IEnumerable< SqlColumnAssignment assignments 
)
inline

Definition at line 27 of file UpdateStatement.cs.

27  {
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");
34 
35  TableName = tableName;
36  WherExpression = wherExpression;
37  Assignments = assignments;
38  }
A long string in the system.
IEnumerable< SqlColumnAssignment > Assignments

Member Function Documentation

IStatement IPreparableStatement. Deveel.Data.Sql.Statements.UpdateStatement.Prepare ( IRequest  context)
inlineprivate

Implements Deveel.Data.Sql.Statements.IPreparableStatement.

Definition at line 48 of file UpdateStatement.cs.

48  {
49  var tableName = context.Query.ResolveTableName(TableName);
50  if (!context.Query.TableExists(tableName))
51  throw new ObjectNotFoundException(tableName);
52 
53  var queryExpression = new SqlQueryExpression(new[]{SelectColumn.Glob("*") });
54  queryExpression.FromClause.AddTable(tableName.FullName);
55  queryExpression.WhereExpression = WherExpression;
56 
57  var queryFrom = QueryExpressionFrom.Create(context, queryExpression);
58  var queryPlan = context.Query.Context.QueryPlanner().PlanQuery(new QueryInfo(context, queryExpression));
59 
60  var columns = new List<SqlAssignExpression>();
61  foreach (var assignment in Assignments) {
62  var columnName = ObjectName.Parse(assignment.ColumnName);
63 
64  var refName = queryFrom.ResolveReference(columnName);
65  var expression = assignment.Expression.Prepare(queryFrom.ExpressionPreparer);
66 
67  var assign = SqlExpression.Assign(SqlExpression.Reference(refName), expression);
68  columns.Add(assign);
69  }
70 
71  return new Prepared(tableName, queryPlan, columns.ToArray(), Limit);
72  }
void AddTable(string alias, FromTable table)
Adds a table as source to the query with a given alias.
Definition: FromClause.cs:93
ObjectName ResolveReference(ObjectName refName)
static SqlAssignExpression Assign(SqlExpression reference, SqlExpression valueExpression)
static QueryExpressionFrom Create(IRequest context, SqlQueryExpression expression)
static SqlBinaryExpression Add(SqlExpression left, SqlExpression right)
IEnumerable< SqlColumnAssignment > Assignments
Represents a column selected to be in the output of a select statement.
Definition: SelectColumn.cs:31
static SqlReferenceExpression Reference(ObjectName objectName)
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. ...

Property Documentation

IEnumerable<SqlColumnAssignment> Deveel.Data.Sql.Statements.UpdateStatement.Assignments
getprivate set

Definition at line 46 of file UpdateStatement.cs.

int Deveel.Data.Sql.Statements.UpdateStatement.Limit
getset

Definition at line 44 of file UpdateStatement.cs.

string Deveel.Data.Sql.Statements.UpdateStatement.TableName
getprivate set

Definition at line 40 of file UpdateStatement.cs.

SqlExpression Deveel.Data.Sql.Statements.UpdateStatement.WherExpression
getprivate set

Definition at line 42 of file UpdateStatement.cs.


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