18 using System.Collections.Generic;
36 this.context = context;
40 get {
return context; }
44 var columnName =
TableInfo[column].ColumnName;
50 var tableName = columnName.
Parent;
52 if (tableName != null && tableName.Equals(TableName)) {
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)) {
68 return indexes[columnOffset];
72 var index = GetColumnIndex(column);
77 return index.GetSubset(table, originalColumn);
88 indexType =
Type.GetType(indexTypeName,
false);
90 indexType =
Type.GetType(indexTypeName,
false,
true);
94 if (indexType == null) {
96 }
else if (!typeof (
ColumnIndex).IsAssignableFrom(indexType)) {
97 throw new InvalidOperationException(String.Format(
"The type '{0}' is not a valid table index.", indexType));
100 SetupIndexes(indexType);
105 for (
int i = 0; i < ColumnCount; i++) {
111 var index = Activator.CreateInstance(indexType,
this, i) as
ColumnIndex;
113 throw new InvalidOperationException();
121 var rows = this.Select(row => row.RowId.RowNumber).ToList();
122 rootInfo.
Add(
this, rows);
126 protected override IEnumerable<int>
ResolveRows(
int column, IEnumerable<int> rowSet,
ITable ancestor) {
127 if (ancestor !=
this)
128 throw new Exception(
"Method routed to incorrect table ancestor.");
134 bool indexableType =
TableInfo[columnNumber].IsIndexable;
136 var index = GetColumnIndex(columnNumber);
137 index.Insert(rowNumber);
142 int colCount = ColumnCount;
144 for (
int i = 0; i < colCount; ++i) {
145 if (tableInfo[i].IsIndexable) {
146 var index = GetColumnIndex(i);
147 index.Insert(rowNumber);
153 int colCount = ColumnCount;
155 for (
int i = 0; i < colCount; ++i) {
156 if (tableInfo[i].IsIndexable) {
157 var index = GetColumnIndex(i);
158 index.Remove(rowNumber);
override int IndexOfColumn(ObjectName columnName)
Defines the contract to access the data contained into a table of a database.
void AddRowToIndex(int rowNumber)
BaseDataTable(IContext context)
override ObjectName GetResolvedColumnName(int column)
Describes the name of an object within a database.
void RemoveRowFromIndex(int rowNumber)
override RawTableInfo GetRawTableInfo(RawTableInfo rootInfo)
const string InsertSearch
A user-defined TYPE that holds complex objects in a database column.
virtual ColumnIndex GetColumnIndex(int columnOffset)
virtual void SetupIndexes(Type indexType)
void Add(IRootTable table, IList< int > rowSet)
ObjectName Parent
Gets the parent reference of the current one, if any or null if none.
void AddToIndex(int rowNumber, int columnNumber)
string Name
Gets the name of the object being referenced.
override ColumnIndex GetIndex(int column, int originalColumn, ITable table)
readonly IContext context
Defines the metadata properties of a table existing within a database.
override IEnumerable< int > ResolveRows(int column, IEnumerable< int > rowSet, ITable ancestor)
void SetupIndexes(string indexTypeName)