DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
Deveel.Data.Sql.Tables.OuterTable Class Reference
Inheritance diagram for Deveel.Data.Sql.Tables.OuterTable:
Deveel.Data.Sql.Tables.VirtualTable Deveel.Data.Sql.Tables.JoinedTable Deveel.Data.Sql.Tables.Table Deveel.Data.Sql.Tables.IQueryTable Deveel.Data.Transactions.ILockable Deveel.Data.Sql.Tables.ITable Deveel.Data.Sql.IDbObject

Public Member Functions

void MergeIn (ITable outsideTable)
 
override DataObject GetValue (long rowNumber, int columnOffset)
 Gets a single cell within the table that is located at the given column offset and row. More...
 
- Public Member Functions inherited from Deveel.Data.Sql.Tables.VirtualTable
 VirtualTable (IEnumerable< ITable > tables)
 
 VirtualTable (IEnumerable< ITable > tables, IList< IList< int >> rows)
 
 VirtualTable (ITable table)
 
 VirtualTable (ITable table, IList< int > rows)
 
- Public Member Functions inherited from Deveel.Data.Sql.Tables.JoinedTable
 JoinedTable (IEnumerable< ITable > tables)
 
 JoinedTable (ITable table)
 
override void Lock ()
 
override void Release ()
 
override IEnumerator< RowGetEnumerator ()
 
- Public Member Functions inherited from Deveel.Data.Sql.Tables.Table
void Dispose ()
 
ColumnIndex GetIndex (int columnOffset)
 Gets an index for given column that can be used to select values from this table. More...
 

Static Public Member Functions

static OuterTable Create (ITable inputTable)
 

Protected Member Functions

override ColumnIndex GetIndex (int column, int originalColumn, ITable table)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Tables.VirtualTable
override void Init (IEnumerable< ITable > tables)
 
override IEnumerable< int > ResolveRowsForTable (IEnumerable< int > rows, int tableNum)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Tables.JoinedTable
override int IndexOfColumn (ObjectName columnName)
 
override RawTableInfo GetRawTableInfo (RawTableInfo rootInfo)
 
override ObjectName GetResolvedColumnName (int column)
 
override IEnumerable< int > ResolveRows (int column, IEnumerable< int > rowSet, ITable ancestor)
 
int ResolveRowForTable (int rowNumber, int tableNum)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Tables.Table
virtual void Dispose (bool disposing)
 
virtual void OnLockAcquired (Lock @lock)
 
virtual void OnLockReleased (Lock @lock)
 
int FindColumn (ObjectName columnName)
 

Properties

override int RowCount [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.VirtualTable
override int RowCount [get]
 
IList< int >[] ReferenceRows [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.JoinedTable
ColumnIndex[] ColumnIndices [get]
 
int[] ColumnTable [get]
 
int[] ColumnFilter [get]
 
override int ColumnCount [get]
 
override IContext Context [get]
 
override TableInfo TableInfo [get]
 
ITable[] ReferenceTables [get]
 
int SortColumn [get, set]
 
- Properties inherited from Deveel.Data.Sql.Tables.Table
abstract IContext Context [get]
 
abstract TableInfo TableInfo [get]
 
bool IsLocked [get, private set]
 
object ILockable. RefId [get]
 
int IQueryTable. ColumnCount [get]
 
virtual int ColumnCount [get]
 
abstract int RowCount [get]
 
ObjectName FullName [get]
 
DbObjectType IDbObject. ObjectType [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.IQueryTable
int ColumnCount [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.ITable
IContext Context [get]
 
TableInfo TableInfo [get]
 Gets the metadata information of the table, used to resolve the column sources. More...
 
int RowCount [get]
 Gets the total number of rows in the table. More...
 
- Properties inherited from Deveel.Data.Sql.IDbObject
ObjectName FullName [get]
 Gets the fully qualified name of the object used to resolve it uniquely within the database. More...
 
DbObjectType ObjectType [get]
 Gets the type of database object that the implementation is for More...
 
- Properties inherited from Deveel.Data.Transactions.ILockable
object RefId [get]
 

Private Member Functions

 OuterTable (IEnumerable< ITable > tables, IList< IList< int >> rows)
 

Private Attributes

readonly IList< int >[] outerRows
 
int outerRowCount
 

Detailed Description

Definition at line 23 of file OuterTable.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Tables.OuterTable.OuterTable ( IEnumerable< ITable tables,
IList< IList< int >>  rows 
)
inlineprivate

Definition at line 27 of file OuterTable.cs.

28  : base(tables, rows) {
29  outerRows = new IList<int>[rows.Count];
30  }
readonly IList< int >[] outerRows
Definition: OuterTable.cs:24

Member Function Documentation

static OuterTable Deveel.Data.Sql.Tables.OuterTable.Create ( ITable  inputTable)
inlinestatic

Definition at line 32 of file OuterTable.cs.

32  {
33  var baseTable = inputTable.GetRawTableInfo();
34  var tables = baseTable.GetTables();
35  var rows = baseTable.GetRows();
36 
37  return new OuterTable(tables, rows);
38  }
OuterTable(IEnumerable< ITable > tables, IList< IList< int >> rows)
Definition: OuterTable.cs:27
override ColumnIndex Deveel.Data.Sql.Tables.OuterTable.GetIndex ( int  column,
int  originalColumn,
ITable  table 
)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Tables.JoinedTable.

Definition at line 82 of file OuterTable.cs.

82  {
83  if (ColumnIndices[column] == null) {
84  // EFFICIENCY: We implement this with a blind search...
85  var index = new BlindSearchIndex(this, column);
86  ColumnIndices[column] = index.GetSubset(this, column);
87  }
88 
89  if (table == this)
90  return ColumnIndices[column];
91 
92  return ColumnIndices[column].GetSubset(table, originalColumn);
93  }
virtual ColumnIndex GetSubset(ITable subsetTable, int subsetColumn)
Definition: ColumnIndex.cs:263
override DataObject Deveel.Data.Sql.Tables.OuterTable.GetValue ( long  rowNumber,
int  columnOffset 
)
inlinevirtual

Gets a single cell within the table that is located at the given column offset and row.

Parameters
rowNumberThe unique number of the row where the cell is located.
columnOffsetThe zero-based offset of the column of the cell to return.
Returns
Returns an instance of DataObject that is contained in the cell located by the row and column coordinates provided.
Exceptions
ArgumentOutOfRangeExceptionIf the given columnOffset is less than zero or greater or equal than the number of columns defined in the table metadata.
See also
Tables.TableInfo.IndexOfColumn(string)

Reimplemented from Deveel.Data.Sql.Tables.JoinedTable.

Definition at line 95 of file OuterTable.cs.

95  {
96  int tableNum = ColumnTable[columnOffset];
97  var parentTable = ReferenceTables[tableNum];
98 
99  if (rowNumber >= outerRowCount) {
100  rowNumber = ReferenceRows[tableNum][(int)rowNumber - outerRowCount];
101  return parentTable.GetValue(rowNumber, ColumnFilter[columnOffset]);
102  }
103 
104  if (outerRows[tableNum] == null)
105  // Special case, handling outer entries (NULL)
106  return new DataObject(TableInfo[columnOffset].ColumnType, null);
107 
108  rowNumber = outerRows[tableNum][(int)rowNumber];
109  return parentTable.GetValue(rowNumber, ColumnFilter[columnOffset]);
110  }
readonly IList< int >[] outerRows
Definition: OuterTable.cs:24
void Deveel.Data.Sql.Tables.OuterTable.MergeIn ( ITable  outsideTable)
inline

Definition at line 44 of file OuterTable.cs.

44  {
45  var rawTableInfo = outsideTable.GetRawTableInfo();
46 
47  // Get the base information,
48  var baseTables = ReferenceTables;
49  IList<int>[] baseRows = ReferenceRows;
50 
51  // The tables and rows being merged in.
52  var tables = rawTableInfo.GetTables();
53  var rows = rawTableInfo.GetRows();
54  // The number of rows being merged in.
55  outerRowCount = rows[0].Count;
56 
57  for (int i = 0; i < baseTables.Length; ++i) {
58  var btable = baseTables[i];
59  int index = -1;
60  for (int n = 0; n < tables.Length && index == -1; ++n) {
61  if (btable == tables[n]) {
62  index = n;
63  }
64  }
65 
66  // If the table wasn't found, then set 'NULL' to this base_table
67  if (index == -1) {
68  outerRows[i] = null;
69  } else {
70  List<int> list = new List<int>(outerRowCount);
71  outerRows[i] = list;
72  // Merge in the rows from the input table,
73  IList<int> toMerge = rows[index];
74  if (toMerge.Count != outerRowCount)
75  throw new InvalidOperationException("Wrong size for rows being merged in.");
76 
77  list.AddRange(toMerge);
78  }
79  }
80  }
readonly IList< int >[] outerRows
Definition: OuterTable.cs:24

Member Data Documentation

int Deveel.Data.Sql.Tables.OuterTable.outerRowCount
private

Definition at line 25 of file OuterTable.cs.

readonly IList<int> [] Deveel.Data.Sql.Tables.OuterTable.outerRows
private

Definition at line 24 of file OuterTable.cs.

Property Documentation

override int Deveel.Data.Sql.Tables.OuterTable.RowCount
get

Definition at line 40 of file OuterTable.cs.


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