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.SubsetColumnTable Class Reference
Inheritance diagram for Deveel.Data.Sql.Tables.SubsetColumnTable:
Deveel.Data.Sql.Tables.FilterTable Deveel.Data.Sql.Tables.IRootTable Deveel.Data.Sql.Tables.Table Deveel.Data.Sql.Tables.ITable Deveel.Data.Sql.Tables.IQueryTable Deveel.Data.Transactions.ILockable Deveel.Data.Sql.IDbObject Deveel.Data.Sql.Tables.ITable Deveel.Data.Sql.IDbObject

Public Member Functions

 SubsetColumnTable (ITable parent, int[] columnMap, ObjectName[] aliases)
 
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.FilterTable
 FilterTable (ITable parent)
 
override IEnumerator< RowGetEnumerator ()
 
override void Lock ()
 
override void Release ()
 
- 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 int IndexOfColumn (ObjectName columnName)
 
override ObjectName GetResolvedColumnName (int column)
 
override ColumnIndex GetIndex (int column, int originalColumn, ITable table)
 
override IEnumerable< int > ResolveRows (int column, IEnumerable< int > rowSet, ITable ancestor)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Tables.FilterTable
override RawTableInfo GetRawTableInfo (RawTableInfo rootInfo)
 
- 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 ColumnCount [get]
 
override TableInfo TableInfo [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.FilterTable
ITable Parent [get, private set]
 
override IContext Context [get]
 
override TableInfo TableInfo [get]
 
override int RowCount [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 SetColumnMap (int[] mapping)
 

Private Attributes

readonly int[] columnMap
 
int[] reverseColumnMap
 
TableInfo subsetTableInfo
 
readonly ObjectName[] aliases
 

Detailed Description

Definition at line 23 of file SubsetColumnTable.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Tables.SubsetColumnTable.SubsetColumnTable ( ITable  parent,
int[]  columnMap,
ObjectName[]  aliases 
)
inline

Definition at line 29 of file SubsetColumnTable.cs.

30  : base(parent) {
31  this.aliases = aliases;
32  this.columnMap = columnMap;
33 
35  }

Member Function Documentation

override ColumnIndex Deveel.Data.Sql.Tables.SubsetColumnTable.GetIndex ( int  column,
int  originalColumn,
ITable  table 
)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Tables.FilterTable.

Definition at line 85 of file SubsetColumnTable.cs.

85  {
86  // We need to map the original_column if the original column is a reference
87  // in this subset column table. Otherwise we leave as is.
88  // The reason is because FilterTable pretends the call came from its
89  // parent if a request is made on this table.
90  int mappedOriginalColumn = originalColumn;
91  if (table == this) {
92  mappedOriginalColumn = columnMap[originalColumn];
93  }
94 
95  return base.GetIndex(columnMap[column], mappedOriginalColumn, table);
96  }
override ObjectName Deveel.Data.Sql.Tables.SubsetColumnTable.GetResolvedColumnName ( int  column)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Tables.FilterTable.

Definition at line 81 of file SubsetColumnTable.cs.

81  {
82  return aliases[column];
83  }
override DataObject Deveel.Data.Sql.Tables.SubsetColumnTable.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.FilterTable.

Definition at line 102 of file SubsetColumnTable.cs.

102  {
103  return Parent.GetValue(rowNumber, columnMap[columnOffset]);
104  }
DataObject GetValue(long rowNumber, int columnOffset)
Gets a single cell within the table that is located at the given column offset and row...
override int Deveel.Data.Sql.Tables.SubsetColumnTable.IndexOfColumn ( ObjectName  columnName)
inlineprotectedvirtual

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

Definition at line 72 of file SubsetColumnTable.cs.

72  {
73  for (int i = 0; i < aliases.Length; ++i) {
74  if (columnName.Equals(aliases[i])) {
75  return i;
76  }
77  }
78  return -1;
79  }
override IEnumerable<int> Deveel.Data.Sql.Tables.SubsetColumnTable.ResolveRows ( int  column,
IEnumerable< int >  rowSet,
ITable  ancestor 
)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Tables.FilterTable.

Definition at line 98 of file SubsetColumnTable.cs.

98  {
99  return base.ResolveRows(columnMap[column], rowSet, ancestor);
100  }
void Deveel.Data.Sql.Tables.SubsetColumnTable.SetColumnMap ( int[]  mapping)
inlineprivate

Definition at line 37 of file SubsetColumnTable.cs.

37  {
38  reverseColumnMap = new int[Parent.ColumnCount()];
39  for (int i = 0; i < reverseColumnMap.Length; ++i) {
40  reverseColumnMap[i] = -1;
41  }
42 
43  var parentInfo = Parent.TableInfo;
44  subsetTableInfo = new TableInfo(parentInfo.TableName);
45 
46  for (int i = 0; i < mapping.Length; ++i) {
47  int mapTo = mapping[i];
48 
49  var origColumnInfo = Parent.TableInfo[mapTo];
50  var columnInfo = new ColumnInfo(aliases[i].Name, origColumnInfo.ColumnType) {
51  DefaultExpression = origColumnInfo.DefaultExpression,
52  IsNotNull = origColumnInfo.IsNotNull,
53  IndexType = origColumnInfo.IndexType
54  };
55 
56  subsetTableInfo.AddColumnSafe(columnInfo);
57 
58  reverseColumnMap[mapTo] = i;
59  }
60 
62  }
void AddColumnSafe(ColumnInfo column)
Definition: TableInfo.cs:203
TableInfo AsReadOnly()
Creates a new instance of TableInfo as an immutable copy of this table metadata.
Definition: TableInfo.cs:342
TableInfo TableInfo
Gets the metadata information of the table, used to resolve the column sources.
Definition: ITable.cs:47
bool Deveel.Data.Sql.Tables.SubsetColumnTable.TypeEquals ( IRootTable  other)
inline

Implements Deveel.Data.Sql.Tables.IRootTable.

Definition at line 106 of file SubsetColumnTable.cs.

106  {
107  return this == other;
108  }

Member Data Documentation

readonly ObjectName [] Deveel.Data.Sql.Tables.SubsetColumnTable.aliases
private

Definition at line 27 of file SubsetColumnTable.cs.

readonly int [] Deveel.Data.Sql.Tables.SubsetColumnTable.columnMap
private

Definition at line 24 of file SubsetColumnTable.cs.

int [] Deveel.Data.Sql.Tables.SubsetColumnTable.reverseColumnMap
private

Definition at line 25 of file SubsetColumnTable.cs.

TableInfo Deveel.Data.Sql.Tables.SubsetColumnTable.subsetTableInfo
private

Definition at line 26 of file SubsetColumnTable.cs.

Property Documentation

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

Definition at line 64 of file SubsetColumnTable.cs.

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

Definition at line 68 of file SubsetColumnTable.cs.


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