Exemple #1
0
        public override Result GetResult(Session session)
        {
            this.CheckAccessRights(session);
            object[]         dynamicArguments = session.sessionContext.DynamicArguments;
            IPersistentStore rowStore         = base.BaseTable.GetRowStore(session);
            int actionType = this.ActionType;

            switch (actionType)
            {
            case 0x12:
            {
                Row row = this.GetRow(session, dynamicArguments);
                if ((row == null) || row.IsDeleted(session, rowStore))
                {
                    throw Error.GetError(0xe25);
                }
                RowSetNavigatorDataChange navigator = new RowSetNavigatorDataChange();
                navigator.AddRow(row);
                StatementDML.Delete(session, base.BaseTable, navigator);
                break;
            }

            case 50:
            {
                object[] newRowData = base.BaseTable.GetNewRowData(session);
                for (int i = 0; i < newRowData.Length; i++)
                {
                    newRowData[base.BaseColumnMap[i]] = dynamicArguments[i];
                }
                return(base.InsertSingleRow(session, rowStore, newRowData));
            }

            default:
                if (actionType == 0x51)
                {
                    Row row = this.GetRow(session, dynamicArguments);
                    if ((row == null) || row.IsDeleted(session, rowStore))
                    {
                        throw Error.GetError(0xe25);
                    }
                    RowSetNavigatorDataChange navigator = new RowSetNavigatorDataChange();
                    object[] data = (object[])row.RowData.Clone();
                    bool[]   newColumnCheckList = base.BaseTable.GetNewColumnCheckList();
                    for (int i = 0; i < base.BaseColumnMap.Length; i++)
                    {
                        if (this.Types[i] != SqlType.SqlAllTypes)
                        {
                            data[base.BaseColumnMap[i]] = dynamicArguments[i];
                            newColumnCheckList[base.BaseColumnMap[i]] = true;
                        }
                    }
                    int[] columnMap = ArrayUtil.BooleanArrayToIntIndexes(newColumnCheckList);
                    navigator.AddRow(session, row, data, base.BaseTable.GetColumnTypes(), columnMap);
                    base.Update(session, base.BaseTable, navigator);
                }
                break;
            }
            return(Result.UpdateOneResult);
        }