String tableName = readIdentifierWithSchema(); checkSchema(schema); CreateTrigger command = new CreateTrigger(session, getSchema()); command.setForce(force); command.setTriggerName(triggerName); command.setIfNotExists(ifNotExists); command.setInsteadOf(insteadOf); command.setBefore(isBefore); command.setOnRollback(onRollback); command.setTypeMask(typeMask); command.setTableName(tableName); if (readIf("FOR")) { read("EACH"); read("ROW"); command.setRowBased(true); } else { command.setRowBased(false); command.setQueueSize(readPositiveInt()); command.setNoWait(readIf("NOWAIT")); if (readIf("AS")) { command.setTriggerSource(readString()); } else { read("CALL"); command.setTriggerClassName(readUniqueIdentifier());
session.commit(true); Database db = session.getDatabase(); if (getSchema().findTrigger(triggerName) != null) { if (ifNotExists) { return 0; triggerName); int id = getObjectId(); Table table = getSchema().getTableOrView(session, tableName); TriggerObject trigger = new TriggerObject(getSchema(), id, triggerName, table); trigger.setInsteadOf(insteadOf); trigger.setBefore(before);
String tableName = readIdentifierWithSchema(); checkSchema(schema); CreateTrigger command = new CreateTrigger(session, getSchema()); command.setForce(force); command.setTriggerName(triggerName); command.setIfNotExists(ifNotExists); command.setBefore(isBefore); command.setTypeMask(typeMask); command.setTableName(tableName); if (readIf("FOR")) { read("EACH"); read("ROW"); command.setRowBased(true); } else { command.setRowBased(false); command.setQueueSize(getPositiveInt()); command.setNoWait(readIf("NOWAIT")); read("CALL"); command.setTriggerClassName(readUniqueIdentifier()); return command;
String tableName = readIdentifierWithSchema(); checkSchema(schema); CreateTrigger command = new CreateTrigger(session, getSchema()); command.setForce(force); command.setTriggerName(triggerName); command.setIfNotExists(ifNotExists); command.setInsteadOf(insteadOf); command.setBefore(isBefore); command.setOnRollback(onRollback); command.setTypeMask(typeMask); command.setTableName(tableName); if (readIf("FOR")) { read("EACH"); read("ROW"); command.setRowBased(true); } else { command.setRowBased(false); command.setQueueSize(readPositiveInt()); command.setNoWait(readIf("NOWAIT")); if (readIf("AS")) { command.setTriggerSource(readString()); } else { read("CALL"); command.setTriggerClassName(readUniqueIdentifier());
public int update() throws SQLException { // TODO rights: what rights are required to create a trigger? session.commit(true); Database db = session.getDatabase(); if (getSchema().findTrigger(triggerName) != null) { if (ifNotExists) { return 0; } throw Message.getSQLException(ErrorCode.TRIGGER_ALREADY_EXISTS_1, triggerName); } int id = getObjectId(false, true); Table table = getSchema().getTableOrView(session, tableName); TriggerObject trigger = new TriggerObject(getSchema(), id, triggerName, table); trigger.setBefore(before); trigger.setNoWait(noWait); trigger.setQueueSize(queueSize); trigger.setRowBased(rowBased); trigger.setTypeMask(typeMask); trigger.setTriggerClassName(session, triggerClassName, force); db.addSchemaObject(session, trigger); table.addTrigger(trigger); return 0; }
String tableName = readIdentifierWithSchema(); checkSchema(schema); CreateTrigger command = new CreateTrigger(session, getSchema()); command.setForce(force); command.setTriggerName(triggerName); command.setIfNotExists(ifNotExists); command.setInsteadOf(insteadOf); command.setBefore(isBefore); command.setOnRollback(onRollback); command.setTypeMask(typeMask); command.setTableName(tableName); if (readIf("FOR")) { read("EACH"); read("ROW"); command.setRowBased(true); } else { command.setRowBased(false); command.setQueueSize(readPositiveInt()); command.setNoWait(readIf("NOWAIT")); if (readIf("AS")) { command.setTriggerSource(readString()); } else { read("CALL"); command.setTriggerClassName(readUniqueIdentifier());
session.commit(true); Database db = session.getDatabase(); if (getSchema().findTrigger(triggerName) != null) { if (ifNotExists) { return 0; triggerName); int id = getObjectId(); Table table = getSchema().getTableOrView(session, tableName); TriggerObject trigger = new TriggerObject(getSchema(), id, triggerName, table); trigger.setInsteadOf(insteadOf); trigger.setBefore(before);
session.commit(true); Database db = session.getDatabase(); if (getSchema().findTrigger(triggerName) != null) { if (ifNotExists) { return 0; triggerName); int id = getObjectId(); Table table = getSchema().getTableOrView(session, tableName); TriggerObject trigger = new TriggerObject(getSchema(), id, triggerName, table); trigger.setInsteadOf(insteadOf); trigger.setBefore(before);