use of org.hsqldb_voltpatches.Session in project voltdb by VoltDB.
the class DatabaseInformationFull method ROLE_COLUMN_GRANTS.
Table ROLE_COLUMN_GRANTS() {
Table t = sysTables[ROLE_COLUMN_GRANTS];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[ROLE_COLUMN_GRANTS]);
// not null
addColumn(t, "GRANTOR", SQL_IDENTIFIER);
// not null
addColumn(t, "GRANTEE", 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);
// not null
addColumn(t, "PRIVILEGE_TYPE", CHARACTER_DATA);
// not null
addColumn(t, "IS_GRANTABLE", YES_OR_NO);
// order: COLUMN_NAME, PRIVILEGE
// for unique: GRANTEE, GRANTOR, TABLE_NAME, TABLE_SCHEMA, TABLE_CAT
// false PK, as TABLE_SCHEMA and/or TABLE_CAT may be null
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[ROLE_COLUMN_GRANTS].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 5, 6, 1, 0, 4, 3, 2 }, false);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
Session sys = database.sessionManager.newSysSession(SqlInvariants.INFORMATION_SCHEMA_HSQLNAME, session.getUser());
Result rs = sys.executeDirectStatement("SELECT GRANTOR, GRANTEE, TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, PRIVILEGE_TYPE, IS_GRANTABLE " + "FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES " + "JOIN INFORMATION_SCHEMA.APPLICABLE_ROLES ON GRANTEE = ROLE_NAME;");
t.insertSys(store, rs);
sys.close();
return t;
}
use of org.hsqldb_voltpatches.Session in project voltdb by VoltDB.
the class DatabaseInformationFull method SQL_PACKAGES.
Table SQL_PACKAGES() {
Table t = sysTables[SQL_PACKAGES];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[SQL_PACKAGES]);
addColumn(t, "ID", CHARACTER_DATA);
addColumn(t, "NAME", CHARACTER_DATA);
addColumn(t, "IS_SUPPORTED", YES_OR_NO);
addColumn(t, "IS_VERIFIED_BY", CHARACTER_DATA);
addColumn(t, "COMMENTS", CHARACTER_DATA);
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[SQL_PACKAGES].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0 }, false);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
Session sys = database.sessionManager.newSysSession(SqlInvariants.INFORMATION_SCHEMA_HSQLNAME, session.getUser());
String sql = (String) statementMap.get("/*sql_packages*/");
Result rs = sys.executeDirectStatement(sql);
t.insertSys(store, rs);
return t;
}
use of org.hsqldb_voltpatches.Session in project voltdb by VoltDB.
the class DatabaseInformationFull method SQL_IMPLEMENTATION_INFO.
Table SQL_IMPLEMENTATION_INFO() {
Table t = sysTables[SQL_IMPLEMENTATION_INFO];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[SQL_IMPLEMENTATION_INFO]);
addColumn(t, "IMPLEMENTATION_INFO_ID", CHARACTER_DATA);
addColumn(t, "IMPLEMENTATION_INFO_NAME", CHARACTER_DATA);
addColumn(t, "INTEGER_VALUE", CARDINAL_NUMBER);
addColumn(t, "CHARACTER_VALUE", CHARACTER_DATA);
addColumn(t, "COMMENTS", CHARACTER_DATA);
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[SQL_IMPLEMENTATION_INFO].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0 }, false);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
Session sys = database.sessionManager.newSysSession(SqlInvariants.INFORMATION_SCHEMA_HSQLNAME, session.getUser());
/*
Result rs = sys.executeDirectStatement(
"VALUES "
+ ";");
t.insertSys(store, rs);
*/
return t;
}
use of org.hsqldb_voltpatches.Session in project voltdb by VoltDB.
the class DatabaseInformationFull method DATA_TYPE_PRIVILEGES.
Table DATA_TYPE_PRIVILEGES() {
Table t = sysTables[DATA_TYPE_PRIVILEGES];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[DATA_TYPE_PRIVILEGES]);
addColumn(t, "OBJECT_CATALOG", SQL_IDENTIFIER);
addColumn(t, "OBJECT_SCHEMA", SQL_IDENTIFIER);
// not null
addColumn(t, "OBJECT_NAME", SQL_IDENTIFIER);
addColumn(t, "OBJECT_TYPE", SQL_IDENTIFIER);
addColumn(t, "DTD_IDENTIFIER", SQL_IDENTIFIER);
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[DATA_TYPE_PRIVILEGES].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0, 1, 2, 3, 4 }, false);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
//
Session sys = database.sessionManager.newSysSession(SqlInvariants.INFORMATION_SCHEMA_HSQLNAME, session.getUser());
String sql = (String) statementMap.get("/*data_type_privileges*/");
Result rs = sys.executeDirectStatement(sql);
t.insertSys(store, rs);
sys.close();
return t;
}
use of org.hsqldb_voltpatches.Session in project voltdb by VoltDB.
the class DatabaseInformationFull method ROLE_TABLE_GRANTS.
Table ROLE_TABLE_GRANTS() {
Table t = sysTables[ROLE_TABLE_GRANTS];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[ROLE_TABLE_GRANTS]);
// not null
addColumn(t, "GRANTOR", SQL_IDENTIFIER);
// not null
addColumn(t, "GRANTEE", 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, "PRIVILEGE_TYPE", CHARACTER_DATA);
// not null
addColumn(t, "IS_GRANTABLE", YES_OR_NO);
addColumn(t, "WITH_HIERARCHY", YES_OR_NO);
// order: TABLE_SCHEM, TABLE_NAME, and PRIVILEGE,
// added for unique: GRANTEE, GRANTOR,
// false PK, as TABLE_SCHEM and/or TABLE_CAT may be null
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[ROLE_TABLE_GRANTS].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 3, 4, 5, 0, 1 }, false);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
Session sys = database.sessionManager.newSysSession(SqlInvariants.INFORMATION_SCHEMA_HSQLNAME, session.getUser());
Result rs = sys.executeDirectStatement("SELECT GRANTOR, GRANTEE, TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, PRIVILEGE_TYPE, IS_GRANTABLE, 'NO' " + "FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES " + "JOIN INFORMATION_SCHEMA.APPLICABLE_ROLES ON GRANTEE = ROLE_NAME;");
t.insertSys(store, rs);
sys.close();
return t;
}
Aggregations