use of org.hsqldb_voltpatches.TriggerDef in project voltdb by VoltDB.
the class DatabaseInformationFull method TRIGGER_SEQUENCE_USAGE.
Table TRIGGER_SEQUENCE_USAGE() {
Table t = sysTables[TRIGGER_SEQUENCE_USAGE];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[TRIGGER_SEQUENCE_USAGE]);
addColumn(t, "TRIGGER_CATALOG", SQL_IDENTIFIER);
addColumn(t, "TRIGGER_SCHEMA", SQL_IDENTIFIER);
// not null
addColumn(t, "TRIGGER_NAME", SQL_IDENTIFIER);
addColumn(t, "SEQUENCE_CATALOG", SQL_IDENTIFIER);
addColumn(t, "SEQUENCE_SCHEMA", SQL_IDENTIFIER);
// not null
addColumn(t, "SEQUENCE_NAME", SQL_IDENTIFIER);
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[TRIGGER_SEQUENCE_USAGE].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0, 1, 2, 3, 4, 5 }, false);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
// column number mappings
final int trigger_catalog = 0;
final int trigger_schema = 1;
final int trigger_name = 2;
final int sequence_catalog = 3;
final int sequence_schema = 4;
final int sequence_name = 5;
Iterator it;
Object[] row;
it = database.schemaManager.databaseObjectIterator(SchemaObject.TRIGGER);
while (it.hasNext()) {
TriggerDef trigger = (TriggerDef) it.next();
if (!session.getGrantee().isAccessible(trigger)) {
continue;
}
OrderedHashSet set = trigger.getReferences();
for (int i = 0; i < set.size(); i++) {
HsqlName refName = (HsqlName) set.get(i);
if (refName.type != SchemaObject.SEQUENCE) {
continue;
}
if (!session.getGrantee().isAccessible(refName)) {
continue;
}
row = t.getEmptyRowData();
row[trigger_catalog] = database.getCatalogName().name;
row[trigger_schema] = trigger.getSchemaName().name;
row[trigger_name] = trigger.getName().name;
row[sequence_catalog] = database.getCatalogName().name;
row[sequence_schema] = refName.schema.name;
row[sequence_name] = refName.name;
try {
t.insertSys(store, row);
} catch (HsqlException e) {
}
}
}
// Initialization
return t;
}
use of org.hsqldb_voltpatches.TriggerDef in project voltdb by VoltDB.
the class DatabaseInformationFull method TRIGGER_TABLE_USAGE.
Table TRIGGER_TABLE_USAGE() {
Table t = sysTables[TRIGGER_TABLE_USAGE];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[TRIGGER_TABLE_USAGE]);
addColumn(t, "TRIGGER_CATALOG", SQL_IDENTIFIER);
addColumn(t, "TRIGGER_SCHEMA", SQL_IDENTIFIER);
// not null
addColumn(t, "TRIGGER_NAME", SQL_IDENTIFIER);
addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER);
addColumn(t, "TABLE_SCHEMA", SQL_IDENTIFIER);
// not null
addColumn(t, "TABLE_NAME", SQL_IDENTIFIER);
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[TRIGGER_TABLE_USAGE].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0, 1, 2, 3, 4, 5 }, false);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
// column number mappings
final int trigger_catalog = 0;
final int trigger_schema = 1;
final int trigger_name = 2;
final int table_catalog = 3;
final int table_schema = 4;
final int table_name = 5;
Iterator it;
Object[] row;
it = database.schemaManager.databaseObjectIterator(SchemaObject.TRIGGER);
while (it.hasNext()) {
TriggerDef trigger = (TriggerDef) it.next();
if (!session.getGrantee().isAccessible(trigger)) {
continue;
}
OrderedHashSet set = trigger.getReferences();
for (int i = 0; i < set.size(); i++) {
HsqlName refName = (HsqlName) set.get(i);
if (refName.type != SchemaObject.TABLE && refName.type != SchemaObject.VIEW) {
continue;
}
if (!session.getGrantee().isAccessible(refName)) {
continue;
}
row = t.getEmptyRowData();
row[trigger_catalog] = database.getCatalogName().name;
row[trigger_schema] = trigger.getSchemaName().name;
row[trigger_name] = trigger.getName().name;
row[table_catalog] = database.getCatalogName().name;
row[table_schema] = refName.schema.name;
row[table_name] = refName.name;
try {
t.insertSys(store, row);
} catch (HsqlException e) {
}
}
}
// Initialization
return t;
}
use of org.hsqldb_voltpatches.TriggerDef in project voltdb by VoltDB.
the class DatabaseInformationFull method TRIGGERS.
Table TRIGGERS() {
Table t = sysTables[TRIGGERS];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[TRIGGERS]);
addColumn(t, "TRIGGER_CATALOG", SQL_IDENTIFIER);
addColumn(t, "TRIGGER_SCHEMA", SQL_IDENTIFIER);
addColumn(t, "TRIGGER_NAME", SQL_IDENTIFIER);
addColumn(t, "EVENT_MANIPULATION", SQL_IDENTIFIER);
addColumn(t, "EVENT_OBJECT_CATALOG", SQL_IDENTIFIER);
addColumn(t, "EVENT_OBJECT_SCHEMA", SQL_IDENTIFIER);
addColumn(t, "EVENT_OBJECT_TABLE", SQL_IDENTIFIER);
addColumn(t, "ACTION_ORDER", CHARACTER_DATA);
addColumn(t, "ACTION_CONDITION", CHARACTER_DATA);
addColumn(t, "ACTION_STATEMENT", CHARACTER_DATA);
addColumn(t, "ACTION_ORIENTATION", CHARACTER_DATA);
addColumn(t, "ACTION_TIMING", CHARACTER_DATA);
addColumn(t, "ACTION_REFERENCE_OLD_TABLE", SQL_IDENTIFIER);
addColumn(t, "ACTION_REFERENCE_NEW_TABLE", SQL_IDENTIFIER);
addColumn(t, "ACTION_REFERENCE_OLD_ROW", SQL_IDENTIFIER);
addColumn(t, "ACTION_REFERENCE_NEW_ROW", SQL_IDENTIFIER);
addColumn(t, "CREATED", TIME_STAMP);
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[TRIGGERS].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0, 1, 2 }, false);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
// column number mappings
final int trigger_catalog = 0;
final int trigger_schema = 1;
final int trigger_name = 2;
final int event_manipulation = 3;
final int event_object_catalog = 4;
final int event_object_schema = 5;
final int event_object_table = 6;
final int action_order = 7;
final int action_condition = 8;
final int action_statement = 9;
final int action_orientation = 10;
final int action_timing = 11;
final int action_reference_old_table = 12;
final int action_reference_new_table = 13;
final int action_reference_old_row = 14;
final int action_reference_new_row = 15;
final int created = 16;
Iterator it;
Object[] row;
it = database.schemaManager.databaseObjectIterator(SchemaObject.TRIGGER);
while (it.hasNext()) {
TriggerDef trigger = (TriggerDef) it.next();
if (!session.getGrantee().isAccessible(trigger)) {
continue;
}
row = t.getEmptyRowData();
row[trigger_catalog] = database.getCatalogName().name;
row[trigger_schema] = trigger.getSchemaName().name;
row[trigger_name] = trigger.getName().name;
row[event_manipulation] = trigger.getEventTypeString();
row[event_object_catalog] = database.getCatalogName().name;
row[event_object_schema] = trigger.getTable().getSchemaName().name;
row[event_object_table] = trigger.getTable().getName().name;
row[action_order] = trigger.getTable().getTriggerIndex(trigger.getName().name);
row[action_condition] = trigger.getConditionSQL();
row[action_statement] = trigger.getProcedureSQL();
row[action_orientation] = trigger.getActionOrientationString();
row[action_timing] = trigger.getActionTimingString();
row[action_reference_old_table] = trigger.getOldTransitionTableName();
row[action_reference_new_table] = trigger.getNewTransitionTableName();
row[action_reference_old_row] = trigger.getOldTransitionRowName();
row[action_reference_new_row] = trigger.getNewTransitionRowName();
row[created] = null;
t.insertSys(store, row);
}
// Initialization
return t;
}
use of org.hsqldb_voltpatches.TriggerDef in project voltdb by VoltDB.
the class DatabaseInformationFull method TRIGGERED_UPDATE_COLUMNS.
Table TRIGGERED_UPDATE_COLUMNS() {
Table t = sysTables[TRIGGERED_UPDATE_COLUMNS];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[TRIGGERED_UPDATE_COLUMNS]);
addColumn(t, "TRIGGER_CATALOG", SQL_IDENTIFIER);
addColumn(t, "TRIGGER_SCHEMA", SQL_IDENTIFIER);
// not null
addColumn(t, "TRIGGER_NAME", SQL_IDENTIFIER);
// not null
addColumn(t, "EVENT_OBJECT_CATALOG", SQL_IDENTIFIER);
addColumn(t, "EVENT_OBJECT_SCHEMA", SQL_IDENTIFIER);
addColumn(t, "EVENT_OBJECT_TABLE", SQL_IDENTIFIER);
// not null
addColumn(t, "EVENT_OBJECT_COLUMN", SQL_IDENTIFIER);
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[TRIGGERED_UPDATE_COLUMNS].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0, 1, 2, 3, 4, 5, 6 }, false);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
// column number mappings
final int trigger_catalog = 0;
final int trigger_schema = 1;
final int trigger_name = 2;
final int event_object_catalog = 3;
final int event_object_schema = 4;
final int event_object_table = 5;
final int event_object_column = 6;
Iterator it;
Object[] row;
it = database.schemaManager.databaseObjectIterator(SchemaObject.TRIGGER);
while (it.hasNext()) {
TriggerDef trigger = (TriggerDef) it.next();
if (!session.getGrantee().isAccessible(trigger)) {
continue;
}
int[] colIndexes = trigger.getUpdateColumnIndexes();
if (colIndexes == null) {
continue;
}
for (int i = 0; i < colIndexes.length; i++) {
ColumnSchema column = trigger.getTable().getColumn(colIndexes[i]);
row = t.getEmptyRowData();
row[trigger_catalog] = database.getCatalogName().name;
row[trigger_schema] = trigger.getSchemaName().name;
row[trigger_name] = trigger.getName().name;
row[event_object_catalog] = database.getCatalogName().name;
row[event_object_schema] = trigger.getTable().getSchemaName().name;
row[event_object_table] = trigger.getTable().getName().name;
row[event_object_column] = column.getNameString();
t.insertSys(store, row);
}
}
// Initialization
return t;
}
use of org.hsqldb_voltpatches.TriggerDef in project voltdb by VoltDB.
the class DatabaseInformationFull method TRIGGER_COLUMN_USAGE.
Table TRIGGER_COLUMN_USAGE() {
Table t = sysTables[TRIGGER_COLUMN_USAGE];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[TRIGGER_COLUMN_USAGE]);
addColumn(t, "TRIGGER_CATALOG", SQL_IDENTIFIER);
addColumn(t, "TRIGGER_SCHEMA", SQL_IDENTIFIER);
// not null
addColumn(t, "TRIGGER_NAME", SQL_IDENTIFIER);
addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER);
addColumn(t, "TABLE_SCHEMA", SQL_IDENTIFIER);
// not null
addColumn(t, "TABLE_NAME", SQL_IDENTIFIER);
// not null
addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER);
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[TRIGGER_COLUMN_USAGE].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0, 1, 2, 3, 4, 5, 6 }, false);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
// column number mappings
final int trigger_catalog = 0;
final int trigger_schema = 1;
final int trigger_name = 2;
final int table_catalog = 3;
final int table_schema = 4;
final int table_name = 5;
final int column_name = 6;
Iterator it;
Object[] row;
it = database.schemaManager.databaseObjectIterator(SchemaObject.TRIGGER);
while (it.hasNext()) {
TriggerDef trigger = (TriggerDef) it.next();
if (!session.getGrantee().isAccessible(trigger)) {
continue;
}
OrderedHashSet set = trigger.getReferences();
for (int i = 0; i < set.size(); i++) {
HsqlName refName = (HsqlName) set.get(i);
if (refName.type != SchemaObject.COLUMN) {
continue;
}
if (!session.getGrantee().isAccessible(refName)) {
continue;
}
row = t.getEmptyRowData();
//
row[trigger_catalog] = database.getCatalogName().name;
row[trigger_schema] = trigger.getSchemaName().name;
row[trigger_name] = trigger.getName().name;
row[table_catalog] = database.getCatalogName().name;
row[table_schema] = refName.parent.schema.name;
row[table_name] = refName.parent.name;
row[column_name] = refName.name;
try {
t.insertSys(store, row);
} catch (HsqlException e) {
}
}
}
// Initialization
return t;
}
Aggregations