示例#1
0
        public void MoveData(Session session, IPersistentStore other, int colindex, int adjust)
        {
            object  defaultValue = null;
            SqlType type         = null;
            SqlType type2        = null;

            if ((adjust >= 0) && (colindex != -1))
            {
                defaultValue = ((Table)this.table).GetColumn(colindex).GetDefaultValue(session);
                type2        = this.table.GetColumnTypes()[colindex];
            }
            if ((adjust <= 0) && (colindex != -1))
            {
                type = other.GetTable().GetColumnTypes()[colindex];
            }
            IRowIterator rowIterator = other.GetRowIterator();
            Table        table       = (Table)this.table;

            try
            {
                while (rowIterator.HasNext())
                {
                    object[] rowData      = rowIterator.GetNextRow().RowData;
                    object[] emptyRowData = table.GetEmptyRowData();
                    object   a            = null;
                    if ((adjust == 0) && (colindex != -1))
                    {
                        a            = rowData[colindex];
                        defaultValue = type2.ConvertToType(session, a, type);
                    }
                    if ((defaultValue != null) && type2.IsLobType())
                    {
                        session.sessionData.AdjustLobUsageCount(defaultValue, 1);
                    }
                    if (((a != null) && (type != null)) && type.IsLobType())
                    {
                        session.sessionData.AdjustLobUsageCount(a, -1);
                    }
                    ArrayUtil.CopyAdjustArray <object>(rowData, emptyRowData, defaultValue, colindex, adjust);
                    table.SystemSetIdentityColumn(session, emptyRowData);
                    table.EnforceTypeLimits(session, emptyRowData);
                    table.EnforceRowConstraints(session, emptyRowData);
                    Row newCachedObject = this.GetNewCachedObject(null, emptyRowData);
                    this.IndexRow(null, newCachedObject);
                }
            }
            catch (OutOfMemoryException)
            {
                throw Error.GetError(460);
            }
        }