Esempio n. 1
0
        public void Storage_Append(EasyTable table, string tablename, uint tableId, uint[] columnId, object[] values)
        {
            if (Transaction == null)
            {
                if (Storage != null)
                {
                    uint rowid = (uint)Storage.Append(tableId, columnId, values);
                    table.RowColumn.Insert(rowid);
                }
                else
                {
                    table.RowColumn.Insert((uint)1);
                }
            }
            else
            {
                EasyTransaction t = Transaction[tablename];
                if (t == null)
                {
                    t       = new EasyTransaction();
                    t.table = table;
                    Transaction.Add(tablename, t);
                }

                EasyDiskRow r = new EasyDiskRow();
                r.tableId  = tableId;
                r.columnId = columnId;
                r.values   = values;
                t.DiskRows.Add(r);
            }
        }
Esempio n. 2
0
        public void Rollback()
        {
            foreach (string tablename in Transaction.Keys)
            {
                EasyTable       table = FindTable(tablename);
                EasyTransaction tran  = Transaction[tablename];

                table.Truncate(tran.RowCount);
                for (int i = 0; i < tran.DeletedRows.Count; i++)
                {
                    table.Undelete(tran.DeletedRows[i], tran.DeletedValues[i]);
                }
            }
            Transaction = null;
        }