18 using System.Collections.Generic;
27 namespace Deveel.Data.Sql.Statements {
60 public bool IsFromQuery {
get;
private set; }
63 ExecuteStatement(context);
67 throw new NotSupportedException(String.Format(
"The statement '{0}' does not support execution", GetType().Name));
76 data.
SetValue(
"SourceQuery", SourceQuery);
77 data.
SetValue(
"IsFromQuery", IsFromQuery);
98 return PrepareAndExecute(null, context);
105 prepared = this.Prepare(preparer, context);
106 }
catch (Exception ex) {
107 throw new InvalidOperationException(
"Unable to prepare the statement for execution.", ex);
110 if (prepared == null)
111 throw new InvalidOperationException();
115 if (!exeContext.HasResult)
118 return exeContext.Result;
133 public static IEnumerable<SqlStatement>
Parse(
string sqlSource) {
134 return Parse(null, sqlSource);
150 public static IEnumerable<SqlStatement>
Parse(
IContext context,
string sqlSource) {
151 return Parse(context,
new SqlQuery(sqlSource));
160 throw new ArgumentNullException(
"query");
162 var compiler = DefaultCompiler;
164 if (context != null) {
170 var result = compiler.Compile(compileContext);
171 if (result.HasErrors)
174 var statements = result.Statements.Cast<
SqlStatement>();
176 foreach (var statement
in statements) {
177 if (statement != null)
184 }
catch (Exception ex) {
185 throw new SqlParseException(
"The input string cannot be parsed into SQL Statements", ex);
void GetData(SerializeData data)
Defines the contract to access the data contained into a table of a database.
void SetSource(SqlQuery query)
static ITable ResultTable(IRequest context, SqlExpression expression)
static IEnumerable< SqlStatement > Parse(IContext context, string sqlSource)
Parses a given string into one of more statements.
void SetValue(string key, Type type, object value)
ITable PrepareAndExecute(IExpressionPreparer preparer, IRequest context)
virtual void GetData(SerializeData data)
Represents the foundation class of SQL statements to be executed.
ITable Execute(IRequest context)
Prepares and evaluates this statement into a tabular result.
void Execute(ExecutionContext context)
An interface used to prepare a SqlExpression object.
static IEnumerable< SqlStatement > Parse(IContext context, SqlQuery query)
virtual void ExecuteStatement(ExecutionContext context)
bool GetBoolean(string key)
SqlStatement(ObjectData data)
object GetValue(string key)
static IEnumerable< SqlStatement > Parse(string sqlSource)
Parses a given string into one of more statements.
An error that occurs when compiling a input string into a SQL object.