DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Protected Member Functions | Properties | Private Attributes | List of all members
Deveel.Data.Sql.Tables.BaseDataTable Class Reference
Inheritance diagram for Deveel.Data.Sql.Tables.BaseDataTable:
Deveel.Data.Sql.Tables.RootTable 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 Deveel.Data.Sql.Tables.FunctionTable Deveel.Data.Sql.Tables.TemporaryTable Deveel.Data.Sql.Tables.UserContextTable

Public Member Functions

void AddToIndex (int rowNumber, int columnNumber)
 
void AddRowToIndex (int rowNumber)
 
void RemoveRowFromIndex (int rowNumber)
 
- Public Member Functions inherited from Deveel.Data.Sql.Tables.RootTable
bool TypeEquals (IRootTable other)
 
- Public Member Functions inherited from Deveel.Data.Sql.Tables.Table
abstract IEnumerator< RowGetEnumerator ()
 
void Dispose ()
 
abstract void Lock ()
 
abstract void Release ()
 
abstract DataObject GetValue (long rowNumber, int columnOffset)
 Gets a single cell within the table that is located at the given column offset and row. More...
 
ColumnIndex GetIndex (int columnOffset)
 Gets an index for given column that can be used to select values from this table. More...
 

Protected Member Functions

 BaseDataTable ()
 
 BaseDataTable (IContext context)
 
override ObjectName GetResolvedColumnName (int column)
 
override int IndexOfColumn (ObjectName columnName)
 
virtual ColumnIndex GetColumnIndex (int columnOffset)
 
override ColumnIndex GetIndex (int column, int originalColumn, ITable table)
 
void SetupIndexes (string indexTypeName)
 
virtual void SetupIndexes (Type indexType)
 
override RawTableInfo GetRawTableInfo (RawTableInfo rootInfo)
 
override IEnumerable< int > ResolveRows (int column, IEnumerable< int > rowSet, ITable ancestor)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Tables.RootTable
virtual bool IsSameTable (RootTable other)
 
- 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]
 
- Properties inherited from Deveel.Data.Sql.Tables.RootTable
ObjectName TableName [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 Attributes

readonly IContext context
 
ColumnIndex[] indexes
 

Detailed Description

Definition at line 26 of file BaseDataTable.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Tables.BaseDataTable.BaseDataTable ( )
inlineprotected

Definition at line 31 of file BaseDataTable.cs.

32  : this(null) {
33  }
Deveel.Data.Sql.Tables.BaseDataTable.BaseDataTable ( IContext  context)
inlineprotected

Definition at line 35 of file BaseDataTable.cs.

35  {
36  this.context = context;
37  }

Member Function Documentation

void Deveel.Data.Sql.Tables.BaseDataTable.AddRowToIndex ( int  rowNumber)
inline

Definition at line 141 of file BaseDataTable.cs.

141  {
142  int colCount = ColumnCount;
143  var tableInfo = TableInfo;
144  for (int i = 0; i < colCount; ++i) {
145  if (tableInfo[i].IsIndexable) {
146  var index = GetColumnIndex(i);
147  index.Insert(rowNumber);
148  }
149  }
150  }
int IQueryTable. ColumnCount
Definition: Table.cs:59
virtual ColumnIndex GetColumnIndex(int columnOffset)
abstract TableInfo TableInfo
Definition: Table.cs:51
void Deveel.Data.Sql.Tables.BaseDataTable.AddToIndex ( int  rowNumber,
int  columnNumber 
)
inline

Definition at line 133 of file BaseDataTable.cs.

133  {
134  bool indexableType = TableInfo[columnNumber].IsIndexable;
135  if (indexableType) {
136  var index = GetColumnIndex(columnNumber);
137  index.Insert(rowNumber);
138  }
139  }
virtual ColumnIndex GetColumnIndex(int columnOffset)
abstract TableInfo TableInfo
Definition: Table.cs:51
virtual ColumnIndex Deveel.Data.Sql.Tables.BaseDataTable.GetColumnIndex ( int  columnOffset)
inlineprotectedvirtual

Reimplemented in Deveel.Data.Sql.Tables.UserContextTable.

Definition at line 67 of file BaseDataTable.cs.

67  {
68  return indexes[columnOffset];
69  }
override ColumnIndex Deveel.Data.Sql.Tables.BaseDataTable.GetIndex ( int  column,
int  originalColumn,
ITable  table 
)
inlineprotectedvirtual

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

Definition at line 71 of file BaseDataTable.cs.

71  {
72  var index = GetColumnIndex(column);
73  if (table == this)
74  return index;
75 
76  // Otherwise, get the scheme to calculate a subset of the given scheme.
77  return index.GetSubset(table, originalColumn);
78  }
virtual ColumnIndex GetColumnIndex(int columnOffset)
override RawTableInfo Deveel.Data.Sql.Tables.BaseDataTable.GetRawTableInfo ( RawTableInfo  rootInfo)
inlineprotectedvirtual

Implements Deveel.Data.Sql.Tables.Table.

Definition at line 120 of file BaseDataTable.cs.

120  {
121  var rows = this.Select(row => row.RowId.RowNumber).ToList();
122  rootInfo.Add(this, rows);
123  return rootInfo;
124  }
override ObjectName Deveel.Data.Sql.Tables.BaseDataTable.GetResolvedColumnName ( int  column)
inlineprotectedvirtual

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

Definition at line 43 of file BaseDataTable.cs.

43  {
44  var columnName = TableInfo[column].ColumnName;
45  return new ObjectName(TableName, columnName);
46  }
abstract TableInfo TableInfo
Definition: Table.cs:51
override int Deveel.Data.Sql.Tables.BaseDataTable.IndexOfColumn ( ObjectName  columnName)
inlineprotectedvirtual

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

Definition at line 48 of file BaseDataTable.cs.

48  {
49  // Check this is the correct table first...
50  var tableName = columnName.Parent;
51  var tableInfo = TableInfo;
52  if (tableName != null && tableName.Equals(TableName)) {
53  // Look for the column name
54  string colName = columnName.Name;
55  int size = ColumnCount;
56  for (int i = 0; i < size; ++i) {
57  var col = tableInfo[i];
58  if (col.ColumnName.Equals(colName)) {
59  return i;
60  }
61  }
62  }
63 
64  return -1;
65  }
string Name
Gets the name part of the table name.
Definition: TableInfo.cs:120
int IQueryTable. ColumnCount
Definition: Table.cs:59
abstract TableInfo TableInfo
Definition: Table.cs:51
void Deveel.Data.Sql.Tables.BaseDataTable.RemoveRowFromIndex ( int  rowNumber)
inline

Definition at line 152 of file BaseDataTable.cs.

152  {
153  int colCount = ColumnCount;
154  var tableInfo = TableInfo;
155  for (int i = 0; i < colCount; ++i) {
156  if (tableInfo[i].IsIndexable) {
157  var index = GetColumnIndex(i);
158  index.Remove(rowNumber);
159  }
160  }
161  }
int IQueryTable. ColumnCount
Definition: Table.cs:59
virtual ColumnIndex GetColumnIndex(int columnOffset)
abstract TableInfo TableInfo
Definition: Table.cs:51
override IEnumerable<int> Deveel.Data.Sql.Tables.BaseDataTable.ResolveRows ( int  column,
IEnumerable< int >  rowSet,
ITable  ancestor 
)
inlineprotectedvirtual

Implements Deveel.Data.Sql.Tables.Table.

Reimplemented in Deveel.Data.Sql.Tables.UserContextTable.

Definition at line 126 of file BaseDataTable.cs.

126  {
127  if (ancestor != this)
128  throw new Exception("Method routed to incorrect table ancestor.");
129 
130  return rowSet;
131  }
void Deveel.Data.Sql.Tables.BaseDataTable.SetupIndexes ( string  indexTypeName)
inlineprotected

Definition at line 80 of file BaseDataTable.cs.

80  {
81  Type indexType;
82  if (String.Equals(indexTypeName, DefaultIndexTypes.BlindSearch)) {
83  indexType = typeof (BlindSearchIndex);
84  } else if (String.Equals(indexTypeName, DefaultIndexTypes.InsertSearch)) {
85  indexType = typeof (InsertSearchIndex);
86  } else {
87 #if PCL
88  indexType = Type.GetType(indexTypeName, false);
89 #else
90  indexType = Type.GetType(indexTypeName, false, true);
91 #endif
92  }
93 
94  if (indexType == null) {
95  indexType = typeof (BlindSearchIndex);
96  } else if (!typeof (ColumnIndex).IsAssignableFrom(indexType)) {
97  throw new InvalidOperationException(String.Format("The type '{0}' is not a valid table index.", indexType));
98  }
99 
100  SetupIndexes(indexType);
101  }
A long string in the system.
A user-defined TYPE that holds complex objects in a database column.
void SetupIndexes(string indexTypeName)
virtual void Deveel.Data.Sql.Tables.BaseDataTable.SetupIndexes ( Type  indexType)
inlineprotectedvirtual

Reimplemented in Deveel.Data.Sql.Tables.UserContextTable.

Definition at line 103 of file BaseDataTable.cs.

103  {
105  for (int i = 0; i < ColumnCount; i++) {
106  if (indexType == typeof (BlindSearchIndex)) {
107  indexes[i] = new BlindSearchIndex(this, i);
108  } else if (indexType == typeof (InsertSearchIndex)) {
109  indexes[i] = new InsertSearchIndex(this, i);
110  } else {
111  var index = Activator.CreateInstance(indexType, this, i) as ColumnIndex;
112  if (index == null)
113  throw new InvalidOperationException();
114 
115  indexes[i] = index;
116  }
117  }
118  }
int IQueryTable. ColumnCount
Definition: Table.cs:59

Member Data Documentation

readonly IContext Deveel.Data.Sql.Tables.BaseDataTable.context
private

Definition at line 27 of file BaseDataTable.cs.

ColumnIndex [] Deveel.Data.Sql.Tables.BaseDataTable.indexes
private

Definition at line 29 of file BaseDataTable.cs.

Property Documentation

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

Definition at line 39 of file BaseDataTable.cs.


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