Ejemplo n.º 1
0
        protected bool DetermineIsSeekable()
        {
            for (int index = 0; index < _conditions.Count; index++)
            {
                if ((_conditions[index].Count > 1) || (_conditions[index][0].Instruction != Instructions.Equal) || !_conditions[index][0].Argument.IsContextLiteral(0))
                {
                    return(false);
                }
            }

            Schema.KeyColumns keyColumns = new Schema.KeyColumns(null);
            for (int index = 0; index < _conditions.Count; index++)
            {
                keyColumns.Add(_conditions[index].Column);
            }

            foreach (Schema.Key key in SourceTableVar.Keys)
            {
                if (!key.IsSparse && (key.Columns.Count == keyColumns.Count) && key.Columns.IsSupersetOf(keyColumns))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        protected Schema.Order FindSeekOrder(Plan plan)
        {
            Schema.KeyColumns keyColumns = new Schema.KeyColumns(null);
            for (int index = 0; index < _conditions.Count; index++)
            {
                keyColumns.Add(_conditions[index].Column);
            }

            foreach (Schema.Key key in SourceTableVar.Keys)
            {
                if (!key.IsSparse && (key.Columns.Count == keyColumns.Count) && key.Columns.IsSupersetOf(keyColumns))
                {
                    return(Compiler.OrderFromKey(plan, key));
                }
            }

            return(null);
        }