18 using System.Collections.Generic;
27 namespace Deveel.Data.Sql.Statements {
51 throw new ArgumentNullException(
"query");
53 var sqlSouce = sqlQuery.
Text;
63 bool statementSeen =
false;
65 var results =
new List<ITable>();
66 foreach (var statement
in statements) {
71 var prepared = statement.Prepare(preparer, query);
77 prepared.Execute(exeContext);
78 if (exeContext.HasResult) {
79 result = exeContext.Result;
86 }
catch (Exception ex) {
87 var sex =
new StatementException(
"An unhanded error occurred while executing the statement.", ex);
98 throw new SqlParseException(
"The input query was not parsed in any statements that could be executed.");
100 return results.ToArray();
103 #region QueryPreparer
118 var varName = varRef.VariableName;
120 var parameter = query.Parameters.FindParameter(varName);
121 if (parameter == null)
124 var value = parameter.SqlType.CreateFrom(parameter.Value);
125 var obj =
new DataObject(parameter.SqlType, value);
Defines the contract to access the data contained into a table of a database.
static ITable[] Execute(IRequest query, SqlQuery sqlQuery)
This method transforms the input SQL query into a set of statements, prepares and executes them again...
static ITable ResultTable(IRequest context, SqlExpression expression)
Represents the foundation class of SQL statements to be executed.
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
An interface used to prepare a SqlExpression object.
QueryPreparer(SqlQuery query)
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
static IEnumerable< SqlStatement > Parse(string sqlSource)
Parses a given string into one of more statements.
SqlExpression Prepare(SqlExpression expression)
Returns the new translated object to be mutated from the given expression.
An error that occurs when compiling a input string into a SQL object.
bool CanPrepare(SqlExpression expression)
Verifies whether the instance of the interface can prepare the given expression.
This class is used to transform an input query to a set of statements and execute them within a given...