DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
TriggerInfo.cs
Go to the documentation of this file.
1 //
2 // Copyright 2010-2015 Deveel
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 using System;
18 using System.Collections.Generic;
19 
20 using Deveel.Data.Sql;
22 
23 namespace Deveel.Data.Sql.Triggers {
29  public class TriggerInfo : IObjectInfo {
39  public TriggerInfo(ObjectName triggerName, TriggerEventType eventType)
40  : this(triggerName, TriggerType.Callback, eventType, null) {
41  }
42 
57  public TriggerInfo(ObjectName triggerName, TriggerType triggerType, TriggerEventType eventType, ObjectName tableName) {
58  if (triggerName == null)
59  throw new ArgumentNullException("triggerName");
60 
61  if (triggerType == TriggerType.Callback &&
62  tableName != null)
63  throw new ArgumentException("A CALLBACK TRIGGER cannot define any table to be attached to.");
64 
65  TriggerName = triggerName;
66  EventType = eventType;
67  TableName = tableName;
68  TriggerType = triggerType;
69 
70  Arguments = new List<SqlExpression>();
71 
72  Body = new TriggerBody(this);
73  }
74 
78  public ObjectName TriggerName { get; private set; }
79 
84  public TriggerEventType EventType { get; private set; }
85 
90  public TriggerType TriggerType { get; private set; }
91 
96  public ObjectName TableName { get; private set; }
97 
101  public TriggerBody Body { get; private set; }
102 
107  public ObjectName ProcedureName { get; set; }
108 
109  public Type ExternalType { get; set; }
110 
111  public string ExternalMethod { get; set; }
112 
113  public ICollection<SqlExpression> Arguments { get; private set; }
114 
116  get { return TriggerName; }
117  }
118 
120  get { return DbObjectType.Trigger; }
121  }
122  }
123 }
Defines the information about a trigger on a table of the database, such as the event on which is fir...
Definition: TriggerInfo.cs:29
TriggerInfo(ObjectName triggerName, TriggerEventType eventType)
Constructs a new callback trigger information object with the given name, and the event at which it s...
Definition: TriggerInfo.cs:39
TriggerEventType
The different types of high layer trigger events.
Describes the name of an object within a database.
Definition: ObjectName.cs:44
A user-defined TYPE that holds complex objects in a database column.
TriggerType
Enumerates the types of triggers, that can be volatile (like the Callback) or stored in the database...
Definition: TriggerType.cs:22
A trigger that exists only within a user session and notifies of an event directly to the user client...
TriggerInfo(ObjectName triggerName, TriggerType triggerType, TriggerEventType eventType, ObjectName tableName)
Constructs a new trigger information object with the given name, the name of the table on which it is...
Definition: TriggerInfo.cs:57
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27