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

Public Member Functions

 CompositeTable (ITable mainTable, ITable[] composites, CompositeFunction function, bool all)
 
 CompositeTable (ITable[] composites, CompositeFunction function, bool all)
 
override IEnumerator< RowGetEnumerator ()
 
override void Lock ()
 
override void Release ()
 
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...
 
bool TypeEquals (IRootTable other)
 
- 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...
 

Protected Member Functions

override RawTableInfo GetRawTableInfo (RawTableInfo rootInfo)
 
override ColumnIndex GetIndex (int column, int originalColumn, ITable table)
 
override IEnumerable< int > ResolveRows (int column, IEnumerable< int > rowSet, ITable ancestor)
 
override ObjectName GetResolvedColumnName (int column)
 
override int IndexOfColumn (ObjectName columnName)
 
- 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 IContext Context [get]
 
override int ColumnCount [get]
 
override int RowCount [get]
 
override TableInfo TableInfo [get]
 
- 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

void RemoveDuplicates (bool all)
 

Private Attributes

readonly ITable mainTable
 
readonly ITable[] composites
 
readonly IList< int >[] rowIndexes
 
readonly ColumnIndex[] columnIndexes
 
int rootsLocked
 

Detailed Description

Definition at line 24 of file CompositeTable.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Tables.CompositeTable.CompositeTable ( ITable  mainTable,
ITable[]  composites,
CompositeFunction  function,
bool  all 
)
inline

Definition at line 33 of file CompositeTable.cs.

33  {
34  this.mainTable = mainTable;
35  this.composites = composites;
36 
38  int size = composites.Length;
39  rowIndexes = new IList<int>[size];
40 
41  if (function == CompositeFunction.Union) {
42  // Include all row sets in all tables
43  for (int i = 0; i < size; ++i) {
44  rowIndexes[i] = composites[i].SelectAllRows().ToList();
45  }
46 
47  RemoveDuplicates(all);
48  } else {
49  throw new InvalidOperationException("Unrecognised composite function");
50  }
51 
52  }
readonly ColumnIndex[] columnIndexes
readonly IList< int >[] rowIndexes
TableInfo TableInfo
Gets the metadata information of the table, used to resolve the column sources.
Definition: ITable.cs:47
int ColumnCount
Gets a count of the columns defined by this object.
Definition: TableInfo.cs:159
CompositeFunction
The kind of composite function in a CompositeTable.
Deveel.Data.Sql.Tables.CompositeTable.CompositeTable ( ITable[]  composites,
CompositeFunction  function,
bool  all 
)
inline

Definition at line 59 of file CompositeTable.cs.

60  : this(composites[0], composites, function, all) {
61  }

Member Function Documentation

override IEnumerator<Row> Deveel.Data.Sql.Tables.CompositeTable.GetEnumerator ( )
inlinevirtual

Implements Deveel.Data.Sql.Tables.Table.

Definition at line 63 of file CompositeTable.cs.

63  {
64  return new SimpleRowEnumerator(this);
65  }
override ColumnIndex Deveel.Data.Sql.Tables.CompositeTable.GetIndex ( int  column,
int  originalColumn,
ITable  table 
)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Tables.Table.

Definition at line 101 of file CompositeTable.cs.

101  {
102  var index = columnIndexes[column];
103  if (index == null) {
104  index = new BlindSearchIndex(this, column);
105  columnIndexes[column] = index;
106  }
107 
108  // If we are getting a scheme for this table, simple return the information
109  // from the column_trees Vector.
110  if (table == this)
111  return index;
112 
113  // Otherwise, get the scheme to calculate a subset of the given scheme.
114  return index.GetSubset(table, originalColumn);
115  }
readonly ColumnIndex[] columnIndexes
virtual ColumnIndex GetSubset(ITable subsetTable, int subsetColumn)
Definition: ColumnIndex.cs:263
override RawTableInfo Deveel.Data.Sql.Tables.CompositeTable.GetRawTableInfo ( RawTableInfo  rootInfo)
inlineprotectedvirtual

Implements Deveel.Data.Sql.Tables.Table.

Definition at line 91 of file CompositeTable.cs.

91  {
92  var rows = this.Select(x => x.RowId.RowNumber).ToArray();
93  rootInfo.Add(this, rows);
94  return rootInfo;
95  }
override ObjectName Deveel.Data.Sql.Tables.CompositeTable.GetResolvedColumnName ( int  column)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Tables.Table.

Definition at line 137 of file CompositeTable.cs.

137  {
138  return mainTable.GetResolvedColumnName(column);
139  }
override DataObject Deveel.Data.Sql.Tables.CompositeTable.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)

Implements Deveel.Data.Sql.Tables.Table.

Definition at line 124 of file CompositeTable.cs.

124  {
125  for (int i = 0; i < rowIndexes.Length; ++i) {
126  var list = rowIndexes[i];
127  int sz = list.Count;
128  if (rowNumber < sz)
129  return composites[i].GetValue(list[(int)rowNumber], columnOffset);
130 
131  rowNumber -= sz;
132  }
133 
134  throw new ArgumentOutOfRangeException("rowNumber", String.Format("Row '{0}' out of range.", rowNumber));
135  }
A long string in the system.
DataObject GetValue(long rowNumber, int columnOffset)
Gets a single cell within the table that is located at the given column offset and row...
readonly IList< int >[] rowIndexes
override int Deveel.Data.Sql.Tables.CompositeTable.IndexOfColumn ( ObjectName  columnName)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Tables.Table.

Definition at line 141 of file CompositeTable.cs.

141  {
142  return mainTable.IndexOfColumn(columnName);
143  }
override void Deveel.Data.Sql.Tables.CompositeTable.Lock ( )
inlinevirtual

Implements Deveel.Data.Sql.Tables.Table.

Definition at line 75 of file CompositeTable.cs.

75  {
76  // For each table, recurse.
77  rootsLocked++;
78  for (int i = 0; i < composites.Length; ++i) {
79  composites[i].Lock();
80  }
81  }
override void Deveel.Data.Sql.Tables.CompositeTable.Release ( )
inlinevirtual

Implements Deveel.Data.Sql.Tables.Table.

Definition at line 83 of file CompositeTable.cs.

83  {
84  // For each table, recurse.
85  rootsLocked--;
86  for (int i = 0; i < composites.Length; ++i) {
87  composites[i].Release();
88  }
89  }
void Deveel.Data.Sql.Tables.CompositeTable.RemoveDuplicates ( bool  all)
inlineprivate

Definition at line 54 of file CompositeTable.cs.

54  {
55  if (!all)
56  throw new NotImplementedException();
57  }
override IEnumerable<int> Deveel.Data.Sql.Tables.CompositeTable.ResolveRows ( int  column,
IEnumerable< int >  rowSet,
ITable  ancestor 
)
inlineprotectedvirtual

Implements Deveel.Data.Sql.Tables.Table.

Definition at line 117 of file CompositeTable.cs.

117  {
118  if (ancestor != this)
119  throw new InvalidOperationException();
120 
121  return rowSet;
122  }
bool Deveel.Data.Sql.Tables.CompositeTable.TypeEquals ( IRootTable  other)
inline

Implements Deveel.Data.Sql.Tables.IRootTable.

Definition at line 149 of file CompositeTable.cs.

149  {
150  return this == other;
151  }

Member Data Documentation

readonly ColumnIndex [] Deveel.Data.Sql.Tables.CompositeTable.columnIndexes
private

Definition at line 29 of file CompositeTable.cs.

readonly ITable [] Deveel.Data.Sql.Tables.CompositeTable.composites
private

Definition at line 26 of file CompositeTable.cs.

readonly ITable Deveel.Data.Sql.Tables.CompositeTable.mainTable
private

Definition at line 25 of file CompositeTable.cs.

int Deveel.Data.Sql.Tables.CompositeTable.rootsLocked
private

Definition at line 31 of file CompositeTable.cs.

readonly IList<int> [] Deveel.Data.Sql.Tables.CompositeTable.rowIndexes
private

Definition at line 28 of file CompositeTable.cs.

Property Documentation

override int Deveel.Data.Sql.Tables.CompositeTable.ColumnCount
getprotected

Definition at line 71 of file CompositeTable.cs.

override IContext Deveel.Data.Sql.Tables.CompositeTable.Context
get

Definition at line 67 of file CompositeTable.cs.

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

Definition at line 97 of file CompositeTable.cs.

override TableInfo Deveel.Data.Sql.Tables.CompositeTable.TableInfo
get

Definition at line 145 of file CompositeTable.cs.


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