public virtual void Insert(Session session, IPersistentStore store, Row row) { bool useRowId = !this.isUnique || this.HasNulls(row.RowData); Monitor.Enter(this._lock); store.LockStore(); try { bool flag2; NodeAVL eavl2; Constraint uniqueConstraintForIndex; Row row2; RowAVL wavl = (RowAVL)row; NodeAVL accessor = this.GetAccessor(store); if (accessor == null) { store.SetAccessor(this, wavl.GetNode(this.Position)); store.SetElementCount(this, 1, 1); return; } Label_005C: row2 = accessor.GetRow(store); int num = this.CompareRowForInsertOrDelete(session, row, row2, useRowId, 0); if ((((num == 0) && (session != null)) && (!useRowId && session.database.TxManager.IsMvRows())) && !this.IsEqualReadable(session, store, accessor)) { useRowId = true; num = this.CompareRowForInsertOrDelete(session, row, row2, useRowId, this.ColIndex.Length); } if (num != 0) { flag2 = num < 0; eavl2 = accessor; accessor = eavl2.Child(store, flag2); if (accessor != null) { goto Label_005C; } } else { uniqueConstraintForIndex = null; if (this.isConstraint) { uniqueConstraintForIndex = ((Table)this.table).GetUniqueConstraintForIndex(this); } goto Label_0119; } eavl2 = eavl2.Set(store, flag2, wavl.GetNode(this.Position)); this.Balance(store, eavl2, flag2); store.UpdateElementCount(this, 1, 1); return; Label_0119: if (uniqueConstraintForIndex == null) { throw Error.GetError(0x68, this.Name.StatementName); } throw uniqueConstraintForIndex.GetException(row.RowData); } finally { store.UnlockStore(); Monitor.Exit(this._lock); } }
public override void Insert(Session session, IPersistentStore store, Row row) { object[] rowData = row.RowData; bool useRowId = !base.isUnique || base.HasNulls(rowData); bool isSimple = base.IsSimple; lock (base._lock) { NodeAVL eavl2; Constraint uniqueConstraintForIndex; RowAVL wavl = (RowAVL)row; NodeAVL accessor = base.GetAccessor(store); if (accessor == null) { store.SetAccessor(this, wavl.GetNode(base.Position)); store.SetElementCount(this, 1, 1); goto Label_01BB; } bool isLeft = false; do { if (base.ColTypes.Length != 0) { int num; Row memoryRow = accessor.MemoryRow; if (isSimple) { num = base.ColTypes[0].Compare(session, rowData[base.ColIndex[0]], memoryRow.RowData[base.ColIndex[0]], null, false); if ((num == 0) & useRowId) { num = base.CompareRowForInsertOrDelete(session, row, memoryRow, useRowId, 1); } } else { num = base.CompareRowForInsertOrDelete(session, row, memoryRow, useRowId, 0); } if ((((num == 0) && (session != null)) && (!useRowId && session.database.TxManager.IsMvRows())) && !base.IsEqualReadable(session, store, accessor)) { useRowId = true; num = base.CompareRowForInsertOrDelete(session, row, memoryRow, useRowId, base.ColIndex.Length); } if (num == 0) { goto Label_013C; } isLeft = num < 0; } eavl2 = accessor; accessor = isLeft ? eavl2.nLeft : eavl2.nRight; }while (accessor != null); goto Label_015C; Label_013C: uniqueConstraintForIndex = null; if (base.isConstraint) { uniqueConstraintForIndex = ((Table)base.table).GetUniqueConstraintForIndex(this); } goto Label_018A; Label_015C: eavl2 = eavl2.Set(store, isLeft, wavl.GetNode(base.Position)); this.Balance(store, eavl2, isLeft); store.UpdateElementCount(this, 1, 1); goto Label_01BB; Label_018A: if (uniqueConstraintForIndex == null) { throw Error.GetError(0x68, base.Name.StatementName); } throw uniqueConstraintForIndex.GetException(row.RowData); Label_01BB :; } }