@Override public Void visitTableTrigger(TableTriggerContext ctx) { if (tables.isEmpty()) return null; Trigger trigger = new Trigger(TriggerType.getTriggerType(ctx.type.getText()), ctx.triggerProcedure.getText()); if (ctx.crc != null) { trigger.setCrc(ctx.crc.getText()); } if (ctx.noOverride != null) trigger.setNoOverride(true); tables.peek().addTrigger(trigger); return null; }
@Override public Void visitTableTrigger(TableTriggerContext ctx) { if (tables.isEmpty()) return null; Trigger trigger = new Trigger(TriggerType.getTriggerType(ctx.type.getText()), ctx.triggerProcedure.getText()); if (ctx.crc != null) { trigger.setCrc(ctx.crc.getText()); } if (ctx.noOverride != null) trigger.setNoOverride(true); tables.peek().addTrigger(trigger); return null; }
@Override public Void visitFieldTrigger(FieldTriggerContext ctx) { if (fields.isEmpty()) return null; if (TriggerType.getTriggerType(ctx.type.getText()) != TriggerType.ASSIGN) { // Value can only be 'ASSIGN', but we just log the problem and return in case of different value LOG.error("'{}' FIELD-TRIGGER found at line {}", ctx.type.getText(), ctx.type.getLine()); return null; } Trigger trigger = new Trigger(TriggerType.ASSIGN, ctx.triggerProcedure.getText()); if (ctx.crc != null) { trigger.setCrc(ctx.crc.getText()); } if (ctx.noOverride != null) trigger.setNoOverride(true); fields.peek().addTrigger(trigger); return null; }
@Override public Void visitFieldTrigger(FieldTriggerContext ctx) { if (fields.isEmpty()) return null; if (TriggerType.getTriggerType(ctx.type.getText()) != TriggerType.ASSIGN) { // Value can only be 'ASSIGN', but we just log the problem and return in case of different value LOG.error("'{}' FIELD-TRIGGER found at line {}", ctx.type.getText(), ctx.type.getLine()); return null; } Trigger trigger = new Trigger(TriggerType.ASSIGN, ctx.triggerProcedure.getText()); if (ctx.crc != null) { trigger.setCrc(ctx.crc.getText()); } if (ctx.noOverride != null) trigger.setNoOverride(true); fields.peek().addTrigger(trigger); return null; }