DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Deveel.Data.Linq.TableQuery Class Reference

Public Member Functions

 TableQuery ()
 
void Column (string columnName, SqlExpression expression)
 
void Column (string columnName, Expression expression)
 
IEnumerable Execute (Type elementType, ITable table)
 

Private Member Functions

ITable ExecuteColumnQuery (ITable table, ColumnQuery columnQuery)
 

Private Attributes

readonly List< ColumnQuerycolumnQueries
 

Detailed Description

Definition at line 26 of file TableQuery.cs.

Constructor & Destructor Documentation

Deveel.Data.Linq.TableQuery.TableQuery ( )
inline

Definition at line 29 of file TableQuery.cs.

29  {
30  columnQueries = new List<ColumnQuery>();
31  }
readonly List< ColumnQuery > columnQueries
Definition: TableQuery.cs:27

Member Function Documentation

void Deveel.Data.Linq.TableQuery.Column ( string  columnName,
SqlExpression  expression 
)
inline

Definition at line 33 of file TableQuery.cs.

33  {
34  columnQueries.Add(new ColumnQuery(columnName, expression));
35  }
readonly List< ColumnQuery > columnQueries
Definition: TableQuery.cs:27
void Deveel.Data.Linq.TableQuery.Column ( string  columnName,
Expression  expression 
)
inline

Definition at line 37 of file TableQuery.cs.

37  {
38  // TODO: convert the source Linq Expression to a SQL Expression
39  throw new NotImplementedException();
40  }
IEnumerable Deveel.Data.Linq.TableQuery.Execute ( Type  elementType,
ITable  table 
)
inline

Definition at line 42 of file TableQuery.cs.

42  {
43  var mapping = new TableTypeMapper(elementType);
44 
45  var finalTable = table;
46  foreach (var columnQuery in columnQueries) {
47  finalTable = ExecuteColumnQuery(finalTable, columnQuery);
48  }
49 
50  mapping.BuildMap(finalTable);
51 
52  var listType = typeof (List<>).MakeGenericType(elementType);
53  var result = (IList) Activator.CreateInstance(listType);
54 
55  foreach (var row in finalTable) {
56  var rowNumber = row.RowId.RowNumber;
57  var mapped = mapping.Construct(finalTable, rowNumber);
58  result.Add(mapped);
59  }
60 
61  return result;
62  }
ITable ExecuteColumnQuery(ITable table, ColumnQuery columnQuery)
Definition: TableQuery.cs:64
readonly List< ColumnQuery > columnQueries
Definition: TableQuery.cs:27
ITable Deveel.Data.Linq.TableQuery.ExecuteColumnQuery ( ITable  table,
ColumnQuery  columnQuery 
)
inlineprivate

Definition at line 64 of file TableQuery.cs.

64  {
65  var expression = columnQuery.Expression;
66  return table.ExhaustiveSelect(null, expression);
67  }

Member Data Documentation

readonly List<ColumnQuery> Deveel.Data.Linq.TableQuery.columnQueries
private

Definition at line 27 of file TableQuery.cs.


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