private TriggerInfo FormTrigger(Row row) { var schema = row.GetValue(0).Value.ToString(); var name = row.GetValue(1).Value.ToString(); var triggerName = new ObjectName(new ObjectName(schema), name); var triggerType = (TriggerType)((SqlNumber)row.GetValue(2).Value).ToInt32(); // TODO: In case it's a procedural trigger, take the reference to the procedure if (triggerType == TriggerType.Procedure) throw new NotImplementedException(); var tableName = ObjectName.Parse(((SqlString) row.GetValue(3).Value).ToString()); var eventType = (TriggerEventType) ((SqlNumber) row.GetValue(4).Value).ToInt32(); return new TriggerInfo(triggerName, triggerType, eventType, tableName); }
private TriggerInfo FormTrigger(Row row) { var schema = row.GetValue(0).Value.ToString(); var name = row.GetValue(1).Value.ToString(); var triggerName = new ObjectName(new ObjectName(schema), name); var triggerType = ((SqlNumber)row.GetValue(2).Value).ToInt32(); var tableName = ObjectName.Parse(((SqlString) row.GetValue(3).Value).ToString()); var eventTime = (TriggerEventTime)((SqlNumber)row.GetValue(4).Value).ToInt32(); var eventType = (TriggerEventType) ((SqlNumber) row.GetValue(5).Value).ToInt32(); TriggerInfo triggerInfo; if (triggerType == ProcedureType) { var procNameString = row.GetValue(6).Value.ToString(); var procName = ObjectName.Parse(procNameString); var argsBinary = (SqlBinary)row.GetValue(7).Value; var args = DeserializeArguments(argsBinary.ToByteArray()); triggerInfo = new ProcedureTriggerInfo(triggerName,tableName, eventTime, eventType, procName); if (args != null && args.Length > 0) { foreach (var expression in args) { ((ProcedureTriggerInfo) triggerInfo).Arguments = args; } } } else if (triggerType == PlSqlType) { var binary = (SqlBinary) row.GetValue(8).Value; var body = binary.ToObject<PlSqlBlockStatement>(); triggerInfo = new PlSqlTriggerInfo(triggerName, tableName, eventTime, eventType, body); } else { throw new InvalidOperationException(); } triggerInfo.Status = (TriggerStatus) ((SqlNumber) row.GetValue(9).Value).ToByte(); return triggerInfo; }
public void UpdateRow(Row row) { if (row.RowId.RowNumber < 0 || row.RowId.RowNumber >= 1) throw new ArgumentOutOfRangeException(); if (readOnly) throw new NotSupportedException(String.Format("Updating '{0}' is not permitted.", tableInfo.TableName)); int sz = TableInfo.ColumnCount; for (int i = 0; i < sz; ++i) { data.SetValue(i, row.GetValue(i)); } }