public static void CreateProcedureTrigger(this IQuery query, ObjectName triggerName, ObjectName tableName, ObjectName procedureName, InvokeArgument[] procedureArgs, TriggerEventTime eventTime, TriggerEventType eventType) { query.ExecuteStatement(new CreateProcedureTriggerStatement(triggerName, tableName, procedureName, procedureArgs, eventTime, eventType)); }
public PlSqlTriggerInfo(ObjectName triggerName, ObjectName tabbleName, TriggerEventTime eventTime, TriggerEventType eventType, PlSqlBlockStatement body) : base(triggerName, TriggerType.Procedural, tabbleName, eventTime, eventType) { if (body == null) throw new ArgumentNullException("body"); Body = body; }
public ProcedureTriggerInfo(ObjectName triggerName, ObjectName tableName, TriggerEventTime eventTime, TriggerEventType eventType, ObjectName procedureName, InvokeArgument[] args) : base(triggerName, TriggerType.External, tableName, eventTime, eventType) { if (procedureName == null) throw new ArgumentNullException("procedureName"); ProcedureName = procedureName; Arguments = args; }
private bool MatchesEvent(TriggerEventTime eventTime, TriggerEventType eventType) { if (eventTime != EventTime) { return(false); } return((EventType & eventType) != 0); }
public PlSqlTriggerInfo(ObjectName triggerName, ObjectName tabbleName, TriggerEventTime eventTime, TriggerEventType eventType, PlSqlBlockStatement body) : base(triggerName, TriggerType.Procedural, tabbleName, eventTime, eventType) { if (body == null) { throw new ArgumentNullException("body"); } Body = body; }
public ProcedureTriggerInfo(ObjectName triggerName, ObjectName tableName, TriggerEventTime eventTime, TriggerEventType eventType, ObjectName procedureName, InvokeArgument[] args) : base(triggerName, TriggerType.External, tableName, eventTime, eventType) { if (procedureName == null) { throw new ArgumentNullException("procedureName"); } ProcedureName = procedureName; Arguments = args; }
internal TableEvent(ITable table, TriggerEventTime eventTime, TriggerEventType eventType, RowId oldRowId, Row newRow) { if (table == null) throw new ArgumentNullException("table"); Table = table; EventTime = eventTime; EventType = eventType; OldRowId = oldRowId; NewRow = newRow; }
public CreateCallbackTriggerStatement(string triggerName, ObjectName tableName, TriggerEventTime eventTime, TriggerEventType eventType) { if (String.IsNullOrEmpty(triggerName)) throw new ArgumentNullException("triggerName"); if (tableName == null) throw new ArgumentNullException("tableName"); TriggerName = triggerName; TableName = tableName; EventTime = eventTime; EventType = eventType; }
protected TriggerInfo(ObjectName triggerName, TriggerType triggerType, ObjectName tableName, TriggerEventTime eventTime, TriggerEventType eventType) { if (triggerName == null) throw new ArgumentNullException("triggerName"); if (tableName == null) throw new ArgumentNullException("tableName"); TriggerName = triggerName; TriggerType = triggerType; TableName = tableName; EventTime = eventTime; EventType = eventType; }
internal TableEvent(ITable table, TriggerEventTime eventTime, TriggerEventType eventType, RowId oldRowId, Row newRow) { if (table == null) { throw new ArgumentNullException("table"); } Table = table; EventTime = eventTime; EventType = eventType; OldRowId = oldRowId; NewRow = newRow; }
public static void CreateProcedureTrigger(this IQuery query, ObjectName triggerName, ObjectName tableName, ObjectName procedureName, SqlExpression[] procedureArgs, TriggerEventTime eventTime, TriggerEventType eventType) { var args = new InvokeArgument[0]; if (procedureArgs != null) { args = procedureArgs.Select(x => new InvokeArgument(x)).ToArray(); } query.ExecuteStatement(new CreateProcedureTriggerStatement(triggerName, tableName, procedureName, args, eventTime, eventType)); }
internal TriggerEvent(TriggerType triggerType, ObjectName triggerName, ObjectName sourceName, TriggerEventTime eventTime, TriggerEventType eventType, RowId oldRowId, Row newRow) { if (triggerName == null) throw new ArgumentNullException("triggerName"); if (sourceName == null) throw new ArgumentNullException("sourceName"); TriggerType = triggerType; TriggerName = triggerName; SourceName = sourceName; EventTime = eventTime; EventType = eventType; OldRowId = oldRowId; NewRow = newRow; }
public CreateTriggerStatement(ObjectName triggerName, ObjectName tableName, PlSqlBlockStatement body, TriggerEventTime eventTime, TriggerEventType eventType) { if (triggerName == null) throw new ArgumentNullException("triggerName"); if (tableName == null) throw new ArgumentNullException("tableName"); if (body == null) throw new ArgumentNullException("body"); TriggerName = triggerName; TableName = tableName; Body = body; EventTime = eventTime; EventType = eventType; }
public CreateCallbackTriggerStatement(string triggerName, ObjectName tableName, TriggerEventTime eventTime, TriggerEventType eventType) { if (String.IsNullOrEmpty(triggerName)) { throw new ArgumentNullException("triggerName"); } if (tableName == null) { throw new ArgumentNullException("tableName"); } TriggerName = triggerName; TableName = tableName; EventTime = eventTime; EventType = eventType; }
public CreateProcedureTriggerStatement(ObjectName triggerName, ObjectName tableName, ObjectName procedureName, InvokeArgument[] args, TriggerEventTime eventTime, TriggerEventType eventType) { if (triggerName == null) throw new ArgumentNullException("triggerName"); if (tableName == null) throw new ArgumentNullException("tableName"); if (procedureName == null) throw new ArgumentNullException("procedureName"); TriggerName = triggerName; TableName = tableName; ProcedureName = procedureName; ProcedureArguments = args; EventTime = eventTime; EventType = eventType; }
protected TriggerInfo(ObjectName triggerName, TriggerType triggerType, ObjectName tableName, TriggerEventTime eventTime, TriggerEventType eventType) { if (triggerName == null) { throw new ArgumentNullException("triggerName"); } if (tableName == null) { throw new ArgumentNullException("tableName"); } TriggerName = triggerName; TriggerType = triggerType; TableName = tableName; EventTime = eventTime; EventType = eventType; }
internal TriggerEvent(TriggerType triggerType, ObjectName triggerName, ObjectName sourceName, TriggerEventTime eventTime, TriggerEventType eventType, RowId oldRowId, Row newRow) { if (triggerName == null) { throw new ArgumentNullException("triggerName"); } if (sourceName == null) { throw new ArgumentNullException("sourceName"); } TriggerType = triggerType; TriggerName = triggerName; SourceName = sourceName; EventTime = eventTime; EventType = eventType; OldRowId = oldRowId; NewRow = newRow; }
public CreateTriggerStatement(ObjectName triggerName, ObjectName tableName, PlSqlBlockStatement body, TriggerEventTime eventTime, TriggerEventType eventType) { if (triggerName == null) { throw new ArgumentNullException("triggerName"); } if (tableName == null) { throw new ArgumentNullException("tableName"); } if (body == null) { throw new ArgumentNullException("body"); } TriggerName = triggerName; TableName = tableName; Body = body; EventTime = eventTime; EventType = eventType; }
public CreateProcedureTriggerStatement(ObjectName triggerName, ObjectName tableName, ObjectName procedureName, InvokeArgument[] args, TriggerEventTime eventTime, TriggerEventType eventType) { if (triggerName == null) { throw new ArgumentNullException("triggerName"); } if (tableName == null) { throw new ArgumentNullException("tableName"); } if (procedureName == null) { throw new ArgumentNullException("procedureName"); } TriggerName = triggerName; TableName = tableName; ProcedureName = procedureName; ProcedureArguments = args; EventTime = eventTime; EventType = eventType; }
private void OnTableEvent(TriggerEventTime eventTime, TriggerEventType eventType, RowId rowId, Row row) { Request.Access().FireTriggers(Request, new TableEvent(this, eventTime, eventType, rowId, row)); }
public override SqlStatement VisitCreateTriggerStatement(PlSqlParser.CreateTriggerStatementContext context) { var triggerName = Name.Object(context.objectName()); var orReplace = context.OR() != null && context.REPLACE() != null; TriggerStatus status = TriggerStatus.Unknown; if (context.DISABLE() != null) { status = TriggerStatus.Disabled; } else if (context.ENABLE() != null) { status = TriggerStatus.Enabled; } var simpleDml = context.simpleDmlTrigger(); ObjectName onObject = null; TriggerEventType eventType = new TriggerEventType(); TriggerEventTime eventTime = new TriggerEventTime(); if (simpleDml != null) { bool before = simpleDml.BEFORE() != null; bool after = simpleDml.AFTER() != null; var events = simpleDml.dmlEventClause().dmlEventElement().Select(x => { if (x.DELETE() != null) { return(TriggerEventType.Delete); } if (x.UPDATE() != null) { return(TriggerEventType.Update); } if (x.INSERT() != null) { return(TriggerEventType.Insert); } throw new InvalidOperationException(); }); foreach (var type in events) { eventType |= type; } if (before) { eventTime = TriggerEventTime.Before; } else if (after) { eventTime = TriggerEventTime.After; } onObject = Name.Object(simpleDml.dmlEventClause().objectName()); } var triggerBody = context.triggerBody(); if (triggerBody.triggerBlock() != null) { var declarations = triggerBody.triggerBlock().declaration().Select(Visit); var body = (PlSqlBody)Visit(triggerBody.triggerBlock().body()); var plsqlBody = body.AsPlSqlStatement(); foreach (var declaration in declarations) { plsqlBody.Declarations.Add(declaration); } return(new CreateTriggerStatement(triggerName, onObject, plsqlBody, eventTime, eventType) { ReplaceIfExists = orReplace, Status = status }); } var procName = Name.Object(triggerBody.objectName()); var args = new InvokeArgument[0]; if (triggerBody.function_argument() != null) { args = triggerBody.function_argument() .argument() .Select(FunctionArgument.Form) .Select(x => new InvokeArgument(x.Id, x.Expression)) .ToArray(); } return(new CreateProcedureTriggerStatement(triggerName, onObject, procName, args, eventTime, eventType) { ReplaceIfExists = orReplace, Status = status }); }
public CallbackTriggerInfo(string triggerName, ObjectName tableName, TriggerEventTime eventTime, TriggerEventType eventType) : base(new ObjectName(triggerName), TriggerType.Callback, tableName, eventTime, eventType) { }
public static void CreateTrigger(this IQuery query, ObjectName triggerName, ObjectName tableName, PlSqlBlockStatement body, TriggerEventTime eventTime, TriggerEventType eventType) { query.ExecuteStatement(new CreateTriggerStatement(triggerName, tableName, body, eventTime, eventType)); }
public void CreateCallbackTrigger(string triggerName, ObjectName tableName, TriggerEventTime eventTime, TriggerEventType eventType) { Session.Context.DeclareTrigger(new CallbackTriggerInfo(triggerName, tableName, eventTime, eventType)); }
public static void CreateCallbackTrigger(this IQuery query, string triggerName, ObjectName tableName, TriggerEventTime eventTime, TriggerEventType eventType) { query.ExecuteStatement(new CreateCallbackTriggerStatement(triggerName, tableName, eventTime, eventType)); }
public static void CreateProcedureTrigger(this IQuery query, ObjectName triggerName, ObjectName tableName, ObjectName procedureName, TriggerEventTime eventTime, TriggerEventType eventType) { CreateProcedureTrigger(query, triggerName, tableName, procedureName, new InvokeArgument[0], eventTime, eventType); }
private bool MatchesEvent(TriggerEventTime eventTime, TriggerEventType eventType) { if (eventTime != EventTime) return false; return (EventType & eventType) != 0; }
public ProcedureTriggerInfo(ObjectName triggerName, ObjectName tableName, TriggerEventTime eventTime, TriggerEventType eventType, ObjectName procedureName) : this(triggerName, tableName, eventTime, eventType, procedureName, new InvokeArgument[0]) { }
public CreateProcedureTriggerStatement(ObjectName triggerName, ObjectName tableName, ObjectName procedureName, TriggerEventTime eventTime, TriggerEventType eventType) : this(triggerName, tableName, procedureName, new InvokeArgument[0], eventTime, eventType) { }
private static string FormMessage(ObjectName tableName, ObjectName triggerName, TriggerEventTime eventTime, TriggerEventType eventType) { return String.Format("An error occurred when firing trigger '{0}' {1} {2} on table '{3}'", triggerName, eventTime, eventType, tableName); }
private static string FormMessage(ObjectName tableName, ObjectName triggerName, TriggerEventTime eventTime, TriggerEventType eventType) { return(String.Format("An error occurred when firing trigger '{0}' {1} {2} on table '{3}'", triggerName, eventTime, eventType, tableName)); }