Esempio n. 1
0
        protected virtual void SetupIndexes(Type indexType)
        {
            indexes = new TableIndex[TableInfo.Columns.Count];
            for (int i = 0; i < TableInfo.Columns.Count; i++)
            {
                var columnName = TableInfo.Columns[i].ColumnName;
                var indexInfo  = new IndexInfo($"#COLIDX_{i}", TableInfo.TableName, columnName);

                if (indexType == typeof(BlindSearchIndex))
                {
                    indexes[i] = new BlindSearchIndex(indexInfo, this);
                }
                else if (indexType == typeof(InsertSearchIndex))
                {
                    indexes[i] = new InsertSearchIndex(indexInfo, this);
                }
                else
                {
                    var index = Activator.CreateInstance(indexType, indexInfo, this) as TableIndex;
                    if (index == null)
                    {
                        throw new InvalidOperationException();
                    }

                    indexes[i] = index;
                }
            }
        }
Esempio n. 2
0
        protected virtual void SetupIndexes(Type indexType)
        {
            indexes = new ColumnIndex[ColumnCount];
            for (int i = 0; i < ColumnCount; i++)
            {
                if (indexType == typeof(BlindSearchIndex))
                {
                    indexes[i] = new BlindSearchIndex(this, i);
                }
                else if (indexType == typeof(InsertSearchIndex))
                {
                    indexes[i] = new InsertSearchIndex(this, i);
                }
                else
                {
                    var index = Activator.CreateInstance(indexType, this, i) as ColumnIndex;
                    if (index == null)
                    {
                        throw new InvalidOperationException();
                    }

                    indexes[i] = index;
                }
            }
        }
Esempio n. 3
0
        protected override ColumnIndex GetIndex(int column, int originalColumn, ITable table)
        {
            if (ColumnIndices[column] == null)
            {
                // EFFICIENCY: We implement this with a blind search...
                var index = new BlindSearchIndex(this, column);
                ColumnIndices[column] = index.GetSubset(this, column);
            }

            if (table == this)
            {
                return(ColumnIndices[column]);
            }

            return(ColumnIndices[column].GetSubset(table, originalColumn));
        }
Esempio n. 4
0
        protected override ColumnIndex GetIndex(int column, int originalColumn, ITable table)
        {
            var index = columnIndexes[column];

            if (index == null)
            {
                index = new BlindSearchIndex(this, column);
                columnIndexes[column] = index;
            }

            // If we are getting a scheme for this table, simple return the information
            // from the column_trees Vector.
            if (table == this)
            {
                return(index);
            }

            // Otherwise, get the scheme to calculate a subset of the given scheme.
            return(index.GetSubset(table, originalColumn));
        }