Beispiel #1
0
        public virtual void IntersectAll(RowSetNavigatorData other)
        {
            object[] b = null;
            this.SortFull();
            other.SortFull();
            IRowIterator emptyIterator = this._queryExpression.FullIndex.GetEmptyIterator();

            while (base.HasNext())
            {
                object[] next = base.GetNext();
                if ((b == null) || (this._queryExpression.FullIndex.CompareRowNonUnique((Session)base.session, next, b, this._visibleColumnCount) > 0))
                {
                    b             = next;
                    emptyIterator = other.FindFirstRow(next);
                }
                object[] objArray3 = emptyIterator.GetNext();
                if ((objArray3 == null) || (this._queryExpression.FullIndex.CompareRowNonUnique((Session)base.session, next, objArray3, this._visibleColumnCount) != 0))
                {
                    this.Remove();
                }
            }
            other.Close();
            this.Reset();
        }
Beispiel #2
0
        public Result GetProcedureResult(Session session)
        {
            Result updateZeroResult;

            object[] objArray = new object[0];
            if (this._arguments.Length != 0)
            {
                objArray = new object[this._arguments.Length];
            }
            Dictionary <string, IRowIterator> dictionary = new Dictionary <string, IRowIterator>();

            for (int i = 0; i < this._arguments.Length; i++)
            {
                Expression expression = this._arguments[i];
                object     a          = expression.GetValue(session);
                if (expression != null)
                {
                    ColumnSchema parameter = this.Procedure.GetParameter(i);
                    SqlType      dataType  = parameter.GetDataType();
                    objArray[i] = dataType.ConvertToType(session, a, expression.GetDataType());
                    if (dataType.IsTableType())
                    {
                        IRowIterator argumentNavigator = this.GetArgumentNavigator(session, expression.GetColumnName());
                        dictionary.Add(parameter.GetName().Name, argumentNavigator);
                    }
                }
            }
            session.sessionContext.Push(true);
            session.sessionContext.PushRoutineTables(this.Procedure.ScopeTables);
            foreach (KeyValuePair <string, IRowIterator> pair in dictionary)
            {
                Table parameterTable = this.Procedure.GetParameterTable(pair.Key);
                if (parameterTable != null)
                {
                    IPersistentStore rowStore = session.sessionData.GetRowStore(parameterTable);
                    parameterTable.ClearAllData(rowStore);
                    IRowIterator iterator2 = pair.Value;
                    while (iterator2.HasNext())
                    {
                        object[] next = iterator2.GetNext();
                        parameterTable.InsertData(session, rowStore, next);
                    }
                }
            }
            session.sessionContext.RoutineArguments = objArray;
            session.sessionContext.RoutineVariables = new object[0];
            if (this.Procedure.IsPsm())
            {
                updateZeroResult = this.ExecutePsmProcedure(session);
            }
            else
            {
                updateZeroResult = this.ExecuteClrProcedure(session);
            }
            object[] routineArguments = session.sessionContext.RoutineArguments;
            session.sessionContext.PopRoutineTables();
            session.sessionContext.Pop(true);
            bool flag = false;

            for (int j = 0; j < this.Procedure.GetParameterCount(); j++)
            {
                if (this.Procedure.GetParameter(j).GetParameterMode() != 1)
                {
                    if (this._arguments[j].IsDynamicParam())
                    {
                        int parameterIndex = this._arguments[j].ParameterIndex;
                        session.sessionContext.DynamicArguments[parameterIndex] = routineArguments[j];
                        flag = true;
                    }
                    else if (this._arguments[j].IsParameter())
                    {
                        int columnIndex = this._arguments[j].GetColumnIndex();
                        session.sessionContext.RoutineArguments[columnIndex] = routineArguments[j];
                    }
                    else
                    {
                        int columnIndex = this._arguments[j].GetColumnIndex();
                        session.sessionContext.RoutineVariables[columnIndex] = routineArguments[j];
                    }
                }
            }
            if (!updateZeroResult.IsError())
            {
                if (updateZeroResult.IsSimpleValue())
                {
                    updateZeroResult = Result.UpdateZeroResult;
                }
                if (flag)
                {
                    updateZeroResult = Result.NewCallResponse(this.GetParametersMetaData().GetParameterTypes(), base.Id, session.sessionContext.DynamicArguments);
                }
            }
            return(updateZeroResult);
        }