/// <summary> /// This is called when a row is in the table, and the SelectableScheme /// objects for each column need to be notified of the rows existance, /// therefore build up the relational model for the columns. /// </summary> /// <param name="rowNumber"></param> internal void AddRowToColumnSchemes(int rowNumber) { int colCount = TableInfo.ColumnCount; DataTableInfo tableInfo = TableInfo; for (int i = 0; i < colCount; ++i) { if (tableInfo[i].DataType.IsIndexable) { SelectableScheme ss = GetRootColumnScheme(i); ss.Insert(rowNumber); } } }
internal override SelectableScheme GetSelectableSchemeFor(int column, int originalColumn, Table table) { SelectableScheme scheme = GetRootColumnScheme(column); // If we are getting a scheme for this table, simple return the information // from the column_trees Vector. if (table == this) { return(scheme); } // Otherwise, get the scheme to calculate a subset of the given scheme. return(scheme.GetSubsetScheme(table, originalColumn)); }
/// <summary> /// This is called when an index to a row needs to be removed from the /// SelectableScheme objects. /// </summary> /// <param name="rowNumber"></param> /// <remarks> /// This occurs when we have a modification log of row removals that haven't /// actually happened to old backed up scheme. /// </remarks> internal void RemoveRowToColumnSchemes(int rowNumber) { int col_count = ColumnCount; DataTableInfo tableInfo = TableInfo; for (int i = 0; i < col_count; ++i) { if (tableInfo[i].IsIndexableType) { SelectableScheme ss = GetRootColumnScheme(i); ss.Remove(rowNumber); } } }
public static IEnumerable <long> SelectRows(this ITable table, int column, Operator op, DataObject cell) { // If the cell is of an incompatible type, return no results, DataType colType = table.TableInfo[column].DataType; if (!cell.DataType.IsComparable(colType)) { // Types not comparable, so return 0 return(new List <long>(0)); } // Get the selectable scheme for this column SelectableScheme ss = table.GetScheme(column); // If the operator is a standard operator, use the interned SelectableScheme // methods. if (op.IsEquivalent(Operator.Equal)) { return(ss.SelectEqual(cell)); } if (op.IsEquivalent(Operator.NotEqual)) { return(ss.SelectNotEqual(cell)); } if (op.IsEquivalent(Operator.Greater)) { return(ss.SelectGreater(cell)); } if (op.IsEquivalent(Operator.Smaller)) { return(ss.SelectLess(cell)); } if (op.IsEquivalent(Operator.GreaterOrEqual)) { return(ss.SelectGreaterOrEqual(cell)); } if (op.IsEquivalent(Operator.SmallerOrEqual)) { return(ss.SelectLessOrEqual(cell)); } // If it's not a standard operator (such as IS, NOT IS, etc) we generate the // range set especially. SelectableRangeSet rangeSet = new SelectableRangeSet(); rangeSet.Intersect(op, cell); return(ss.SelectRange(rangeSet.ToArray())); }
/// <summary> /// Returns a <see cref="SelectableScheme"/> for the given column in the given /// <see cref="VirtualTable"/> row domain. /// </summary> /// <param name="column"></param> /// <param name="originalColumn"></param> /// <param name="table"></param> /// <remarks> /// This searches down through the tables ancestors until it comes across a table /// with a <see cref="SelectableScheme"/> where the given column is fully resolved. /// In most cases, this will be the root <see cref="DataTable"/>. /// </remarks> /// <returns></returns> internal override SelectableScheme GetSelectableSchemeFor(int column, int originalColumn, Table table) { // First check if the given SelectableScheme is in the column_scheme array SelectableScheme scheme = columnScheme[column]; if (scheme != null) { if (table == this) { return(scheme); } return(scheme.GetSubsetScheme(table, originalColumn)); } // If it isn't then we need to calculate it SelectableScheme ss; // Optimization: The table may be naturally ordered by a column. If it // is we don't try to generate an ordered set. if (sortedAgainstColumn != -1 && sortedAgainstColumn == column) { InsertSearch isop = new InsertSearch(this, column, CalculateRowReferenceList().Cast <int>()); isop.RecordUid = false; ss = isop; columnScheme[column] = ss; if (table != this) { ss = ss.GetSubsetScheme(table, originalColumn); } } else { // Otherwise we must generate the ordered set from the information in // a parent index. Table parent_table = referenceList[columnTable[column]]; ss = parent_table.GetSelectableSchemeFor(columnFilter[column], originalColumn, table); if (table == this) { columnScheme[column] = ss; } } return(ss); }
internal override SelectableScheme GetSelectableSchemeFor(int column, int originalColumn, Table table) { if (columnScheme == null) { columnScheme = new SelectableScheme[Parent.TableInfo.ColumnCount]; } // Is there a local scheme available? SelectableScheme scheme = columnScheme[column]; if (scheme == null) { // If we are asking for the selectable schema of this table we must // tell the parent we are looking for its selectable scheme. Table t = table; if (table == this) { t = Parent; } // Scheme is not cached in this table so ask the parent. scheme = Parent.GetSelectableSchemeFor(column, originalColumn, t); if (table == this) { columnScheme[column] = scheme; } } else { // If this has a cached scheme and we are in the correct domain then // return it. if (table == this) { return(scheme); } else { // Otherwise we must calculate the subset of the scheme return(scheme.GetSubsetScheme(table, originalColumn)); } } return(scheme); }
public static IList <long> SelectRange(this ITable table, int column, SelectableRange[] ranges) { SelectableScheme ss = table.GetScheme(column); return(ss.SelectRange(ranges)); }
public static IEnumerable <long> SelectAll(this ITable table, int column) { SelectableScheme ss = table.GetScheme(column); return(ss.SelectAll()); }