protected virtual void BlankSelectableSchemes(int type) { columnScheme = new SelectableScheme[TableInfo.ColumnCount]; for (int i = 0; i < columnScheme.Length; ++i) { if (type == 0) { columnScheme[i] = new InsertSearch(this, i); } else if (type == 1) { columnScheme[i] = new BlindSearch(this, i); } } }
/// <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) { // 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 parentTable = referenceList[vtTableInfo.IndexOfTable(column)]; ss = parentTable.GetSelectableSchemeFor(vtTableInfo.AdjustColumnOffset(column), originalColumn, table); if (table == this) { columnScheme[column] = ss; } } return ss; }
/// <summary> /// Blanks all the column schemes in this table to a specific /// type of scheme. /// </summary> /// <param name="type">The type of the new scheme to set. If 0 /// then <see cref="InsertSearch"/> (fast but takes up memory - /// requires each insert and delete from the table to be logged). /// If 1 then <see cref="BlindSearch"/> (slower but uses no memory /// and doesn't require insert and delete to be logged).</param> protected virtual void BlankSelectableSchemes(int type) { columnScheme = new SelectableScheme[ColumnCount]; for (int i = 0; i < columnScheme.Length; ++i) { if (type == 0) { columnScheme[i] = new InsertSearch(this, i); } else if (type == 1) { columnScheme[i] = new BlindSearch(this, i); } } }