DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | List of all members
Deveel.Data.Sql.Compile.SqlDefaultCompiler Class Reference
Inheritance diagram for Deveel.Data.Sql.Compile.SqlDefaultCompiler:
Deveel.Data.Sql.Compile.ISqlCompiler

Public Member Functions

SqlCompileResult Compile (SqlCompileContext context)
 
void Dispose ()
 

Detailed Description

Definition at line 25 of file SqlDefaultCompiler.cs.

Member Function Documentation

SqlCompileResult Deveel.Data.Sql.Compile.SqlDefaultCompiler.Compile ( SqlCompileContext  context)
inline

Implements Deveel.Data.Sql.Compile.ISqlCompiler.

Definition at line 26 of file SqlDefaultCompiler.cs.

26  {
27  if (context == null)
28  throw new ArgumentNullException("context");
29 
30  var compileResult = new SqlCompileResult(context);
31 
32  try {
33  var sqlSource = context.SourceText;
34  var result = SqlParsers.Default.Parse(sqlSource);
35 
36  foreach (var error in result.Errors) {
37  var location = new SourceLocation(error.Line, error.Column);
38  compileResult.Messages.Add(new SqlCompileMessage(CompileMessageLevel.Error, error.Message, location));
39  }
40 
41  ITypeResolver typeResolver = null;
42  if (context.Context != null)
43  typeResolver = context.Context.TypeResolver();
44 
45  var builder = new StatementBuilder(typeResolver);
46  var statements = builder.Build(result.RootNode);
47 
48  foreach (var statement in statements) {
49  compileResult.Statements.Add(statement);
50  }
51 
52  } catch (SqlParseException ex) {
53  compileResult.Messages.Add(new SqlCompileMessage(CompileMessageLevel.Error, ex.Message));
54  } catch (Exception ex) {
55  compileResult.Messages.Add(new SqlCompileMessage(CompileMessageLevel.Error, ex.Message));
56  }
57 
58  return compileResult;
59  }
static readonly ISqlParser Default
Definition: SqlParsers.cs:23
SqlParseResult Parse(string input)
Analyzes and parses the input and results an object that describes the parsed nodes in a tree that ca...
An error that occurs when compiling a input string into a SQL object.
void Deveel.Data.Sql.Compile.SqlDefaultCompiler.Dispose ( )
inline

Definition at line 61 of file SqlDefaultCompiler.cs.

61  {
62  }

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