DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Classes | Public Member Functions | Static Public Member Functions | List of all members
Deveel.Data.Sql.Statements.ColumnChecker Class Referenceabstract
Inheritance diagram for Deveel.Data.Sql.Statements.ColumnChecker:
Deveel.Data.Sql.Statements.ColumnChecker.DefaultChecker Deveel.Data.Sql.Statements.CreateTableStatement.TableColumnChecker

Classes

class  DefaultChecker
 
class  ExpressionChecker
 

Public Member Functions

string StripTableName (string tableDomain, string column)
 
IEnumerable< string > StripColumnList (string tableDomain, IEnumerable< string > columnList)
 
abstract string ResolveColumnName (string columnName)
 
SqlExpression CheckExpression (SqlExpression expression)
 
IEnumerable< string > CheckColumns (IEnumerable< string > columnNames)
 

Static Public Member Functions

static ColumnChecker Default (IRequest context, ObjectName tableName)
 

Detailed Description

Definition at line 27 of file ColumnChecker.cs.

Member Function Documentation

IEnumerable<string> Deveel.Data.Sql.Statements.ColumnChecker.CheckColumns ( IEnumerable< string >  columnNames)
inline

Definition at line 54 of file ColumnChecker.cs.

54  {
55  var result = new List<string>();
56 
57  foreach (var columnName in columnNames) {
58  var resolved = ResolveColumnName(columnName);
59  if (resolved == null)
60  throw new InvalidOperationException(String.Format("Column '{0}' not found in table.", columnName));
61 
62  result.Add(resolved);
63  }
64 
65  return result.ToArray();
66  }
A long string in the system.
abstract string ResolveColumnName(string columnName)
SqlExpression Deveel.Data.Sql.Statements.ColumnChecker.CheckExpression ( SqlExpression  expression)
inline

Definition at line 49 of file ColumnChecker.cs.

49  {
50  var expChecker = new ExpressionChecker(this);
51  return expChecker.Visit(expression);
52  }
static ColumnChecker Deveel.Data.Sql.Statements.ColumnChecker.Default ( IRequest  context,
ObjectName  tableName 
)
inlinestatic

Definition at line 68 of file ColumnChecker.cs.

68  {
69  var table = context.Query.GetTable(tableName);
70  if (table == null)
71  throw new InvalidOperationException(String.Format("Table '{0}' not found in the context.", tableName));
72 
73  var tableInfo = table.TableInfo;
74  var ignoreCase = context.Query.IgnoreIdentifiersCase();
75 
76  return new DefaultChecker(tableInfo, ignoreCase);
77  }
A long string in the system.
abstract string Deveel.Data.Sql.Statements.ColumnChecker.ResolveColumnName ( string  columnName)
pure virtual
IEnumerable<string> Deveel.Data.Sql.Statements.ColumnChecker.StripColumnList ( string  tableDomain,
IEnumerable< string >  columnList 
)
inline

Definition at line 43 of file ColumnChecker.cs.

43  {
44  return columnList.Select(x => StripTableName(tableDomain, x));
45  }
string StripTableName(string tableDomain, string column)
string Deveel.Data.Sql.Statements.ColumnChecker.StripTableName ( string  tableDomain,
string  column 
)
inline

Definition at line 28 of file ColumnChecker.cs.

28  {
29  var index = column.IndexOf('.');
30 
31  if (index != -1) {
32  var columnPrefix = column.Substring(0, index);
33  if (!columnPrefix.Equals(tableDomain))
34  throw new InvalidOperationException(String.Format("Column '{0}' is not within the expected table'{1}'",
35  column, tableDomain));
36 
37  column = column.Substring(index + 1);
38  }
39 
40  return column;
41  }
A long string in the system.

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