private void ProcessCreateTrigger(Session session, SchemaManager schemaManager) { TriggerDef td = (TriggerDef)this.Arguments[0]; QNameManager.QName name = (QNameManager.QName) this.Arguments[1]; CheckSchemaUpdateAuthorisation(session, td.GetSchemaName()); schemaManager.CheckSchemaObjectNotExists(td.GetName()); if ((name != null) && (schemaManager.GetSchemaObject(name) == null)) { throw Error.GetError(0x157d, name.Name); } td.table.AddTrigger(td, name); schemaManager.AddSchemaObject(td); }
public override void AddTrigger(TriggerDef td, QNameManager.QName otherName) { int operationType = td.OperationType; switch (operationType) { case 0x13: if (this._isTriggerDeletable) { throw Error.GetError(0x15a9); } this._isTriggerDeletable = true; break; case 50: if (this._isTriggerInsertable) { throw Error.GetError(0x15a9); } this._isTriggerInsertable = true; break; default: if (operationType != 0x52) { throw Error.RuntimeError(0xc9, "View"); } if (this._isTriggerUpdatable) { throw Error.GetError(0x15a9); } this._isTriggerUpdatable = true; break; } base.AddTrigger(td, otherName); }
public override void RemoveTrigger(TriggerDef td) { int operationType = td.OperationType; switch (operationType) { case 0x13: this._isTriggerDeletable = false; break; case 50: this._isTriggerInsertable = false; break; default: if (operationType != 0x52) { throw Error.RuntimeError(0xc9, "View"); } this._isTriggerInsertable = false; break; } base.RemoveTrigger(td); }
public void GetTriggerTableNames(OrderedHashSet <QNameManager.QName> set, bool write) { int index = 0; while (index < base.BaseTable.TriggerList.Length) { TriggerDef def = base.BaseTable.TriggerList[index]; int type = base.type; if (type <= 50) { if (type == 0x13) { if (def.GetStatementType() != 0x13) { goto Label_0070; } } else { if (type != 50) { goto Label_00A9; } if (def.GetStatementType() != 50) { goto Label_0070; } } goto Label_0076; } if (type != 0x52) { if (type != 0x80) { goto Label_00A9; } if ((def.GetStatementType() != 50) && (def.GetStatementType() != 0x52)) { goto Label_0070; } goto Label_0076; } if (def.GetStatementType() == 0x52) { goto Label_0076; } Label_0070: index++; continue; Label_0076: if (def.routine != null) { if (write) { set.AddAll(def.routine.GetTableNamesForWrite()); } else { set.AddAll(def.routine.GetTableNamesForRead()); } } goto Label_0070; Label_00A9: throw Error.RuntimeError(0xc9, "StatementDML"); } }