Пример #1
0
        public void InsertRowSet(Session session, RowSetNavigator generatedNavigator, RowSetNavigator newData)
        {
            IPersistentStore rowStore = base.BaseTable.GetRowStore(session);
            IRangeIterator   iterator = null;

            if (this.UpdatableTableCheck != null)
            {
                iterator = this._checkRangeVariable.GetIterator(session);
            }
            newData.BeforeFirst();
            if (base.BaseTable.TriggerLists[6].Length != 0)
            {
                while (newData.HasNext())
                {
                    object[] next = newData.GetNext();
                    base.BaseTable.FireTriggers(session, 6, null, next, null);
                }
                newData.BeforeFirst();
            }
            while (newData.HasNext())
            {
                object[] next = newData.GetNext();
                base.BaseTable.InsertSingleRow(session, rowStore, next, null);
                if (iterator != null)
                {
                    iterator.SetCurrent(next);
                    if (!this.UpdatableTableCheck.TestCondition(session))
                    {
                        throw Error.GetError(0x1644);
                    }
                }
                if (generatedNavigator != null)
                {
                    object[] generatedColumns = base.GetGeneratedColumns(next);
                    generatedNavigator.Add(generatedColumns);
                }
            }
            newData.BeforeFirst();
            while (newData.HasNext())
            {
                object[] next = newData.GetNext();
                PerformIntegrityChecks(session, base.BaseTable, null, next, null);
            }
            newData.BeforeFirst();
            if (base.BaseTable.TriggerLists[3].Length != 0)
            {
                while (newData.HasNext())
                {
                    object[] next = newData.GetNext();
                    base.BaseTable.FireTriggers(session, 3, null, next, null);
                }
                newData.BeforeFirst();
            }
        }
Пример #2
0
        public RowSetNavigator GetInsertSelectNavigator(Session session)
        {
            SqlType[]       columnTypes     = base.BaseTable.GetColumnTypes();
            int[]           insertColumnMap = base.InsertColumnMap;
            Result          result          = base.queryExpression.GetResult(session, 0);
            RowSetNavigator navigator       = result.InitialiseNavigator();

            SqlType[]             typeArray2 = result.MetaData.ColumnTypes;
            RowSetNavigatorClient client     = new RowSetNavigatorClient(2);

            while (navigator.HasNext())
            {
                object[] newRowData = base.BaseTable.GetNewRowData(session);
                object[] next       = navigator.GetNext();
                for (int i = 0; i < insertColumnMap.Length; i++)
                {
                    int index = insertColumnMap[i];
                    if (index != this.OverrideUserValue)
                    {
                        SqlType type = typeArray2[i];
                        newRowData[index] = columnTypes[index].ConvertToType(session, next[i], type);
                    }
                }
                client.Add(newRowData);
            }
            return(client);
        }
Пример #3
0
        protected void WriteSingleColumnResult(Result r)
        {
            RowSetNavigator navigator = r.InitialiseNavigator();

            while (navigator.HasNext())
            {
                object[] next = navigator.GetNext();
                this.WriteLogStatement(this.CurrentSession, (string)next[0]);
            }
        }
Пример #4
0
 public override void InsertValuesIntoSubqueryTable(Session session, IPersistentStore store)
 {
     if (!this._isTable)
     {
         object[] objArray2 = (object[])base.nodes[0].GetValue(session);
         for (int i = 0; i < objArray2.Length; i++)
         {
             object[] objArray3;
             if (this._ordinality)
             {
                 objArray3 = new object[] { objArray2[i], i };
             }
             else
             {
                 objArray3 = new object[] { objArray2[i] };
             }
             Row newCachedObject = store.GetNewCachedObject(session, objArray3);
             try
             {
                 store.IndexRow(session, newCachedObject);
             }
             catch (CoreException)
             {
             }
         }
     }
     else
     {
         RowSetNavigator navigator = base.nodes[0].GetResult(session).GetNavigator();
         while (navigator.HasNext())
         {
             object[] next            = navigator.GetNext();
             Row      newCachedObject = store.GetNewCachedObject(session, next);
             try
             {
                 store.IndexRow(session, newCachedObject);
                 continue;
             }
             catch (CoreException)
             {
                 continue;
             }
         }
     }
 }