use of org.hsqldb_voltpatches.result.Result in project voltdb by VoltDB.
the class Session method executeDirectStatement.
public Result executeDirectStatement(Result cmd) {
String sql = cmd.getMainString();
HsqlArrayList list;
try {
list = parser.compileStatements(sql, cmd.getStatementType());
} catch (HsqlException e) {
return Result.newErrorResult(e);
}
Result result = null;
for (int i = 0; i < list.size(); i++) {
Statement cs = (Statement) list.get(i);
result = executeCompiledStatement(cs, ValuePool.emptyObjectArray);
if (result.isError()) {
break;
}
}
return result;
}
use of org.hsqldb_voltpatches.result.Result in project voltdb by VoltDB.
the class Session method executeDirectStatement.
public Result executeDirectStatement(String sql) {
Statement cs;
parser.reset(sql);
try {
cs = parser.compileStatement();
} catch (HsqlException e) {
return Result.newErrorResult(e);
}
Result result = executeCompiledStatement(cs, ValuePool.emptyObjectArray);
return result;
}
use of org.hsqldb_voltpatches.result.Result in project voltdb by VoltDB.
the class DatabaseInformationFull method ROLE_ROUTINE_GRANTS.
Table ROLE_ROUTINE_GRANTS() {
Table t = sysTables[ROLE_ROUTINE_GRANTS];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[ROLE_ROUTINE_GRANTS]);
// not null
addColumn(t, "GRANTOR", SQL_IDENTIFIER);
// not null
addColumn(t, "GRANTEE", SQL_IDENTIFIER);
addColumn(t, "SPECIFIC_CATALOG", SQL_IDENTIFIER);
addColumn(t, "SPECIFIC_SCHEMA", SQL_IDENTIFIER);
// not null
addColumn(t, "SPECIFIC_NAME", SQL_IDENTIFIER);
addColumn(t, "ROUTINE_CATALOG", SQL_IDENTIFIER);
addColumn(t, "ROUTINE_SCHEMA", SQL_IDENTIFIER);
addColumn(t, "ROUTINE_NAME", SQL_IDENTIFIER);
addColumn(t, "PRIVILEGE_TYPE", CHARACTER_DATA);
addColumn(t, "IS_GRANTABLE", YES_OR_NO);
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[ROLE_ROUTINE_GRANTS].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, 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, SPECIFIC_CATALOG, SPECIFIC_SCHEMA, " + "SPECIFIC_NAME, ROUTINE_CATALOG, ROUTINE_SCHEMA, ROUTINE_NAME, " + "PRIVILEGE_TYPE, IS_GRANTABLE, 'NO' " + "FROM INFORMATION_SCHEMA.ROUTINE_PRIVILEGES " + "JOIN INFORMATION_SCHEMA.APPLICABLE_ROLES ON GRANTEE = ROLE_NAME;");
t.insertSys(store, rs);
sys.close();
// Column number mappings
final int grantor = 0;
final int grantee = 1;
final int table_name = 2;
final int specific_catalog = 3;
final int specific_schema = 4;
final int specific_name = 5;
final int routine_catalog = 6;
final int routine_schema = 7;
final int routine_name = 8;
final int privilege_type = 9;
final int is_grantable = 10;
//
return t;
}
use of org.hsqldb_voltpatches.result.Result in project voltdb by VoltDB.
the class DatabaseInformationFull method SQL_FEATURES.
Table SQL_FEATURES() {
Table t = sysTables[SQL_FEATURES];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[SQL_FEATURES]);
addColumn(t, "FEATURE_ID", CHARACTER_DATA);
addColumn(t, "FEATURE_NAME", CHARACTER_DATA);
addColumn(t, "SUB_FEATURE_ID", CHARACTER_DATA);
addColumn(t, "SUB_FEATURE_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_FEATURES].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0, 2 }, 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_features*/");
Result rs = sys.executeDirectStatement(sql);
t.insertSys(store, rs);
return t;
}
use of org.hsqldb_voltpatches.result.Result in project voltdb by VoltDB.
the class DatabaseInformationFull method ROLE_USAGE_GRANTS.
Table ROLE_USAGE_GRANTS() {
Table t = sysTables[ROLE_USAGE_GRANTS];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[ROLE_USAGE_GRANTS]);
// not null
addColumn(t, "GRANTOR", SQL_IDENTIFIER);
// not null
addColumn(t, "GRANTEE", SQL_IDENTIFIER);
addColumn(t, "OBJECT_CATALOG", SQL_IDENTIFIER);
addColumn(t, "OBJECT_SCHEMA", SQL_IDENTIFIER);
// not null
addColumn(t, "OBJECT_NAME", SQL_IDENTIFIER);
// not null
addColumn(t, "OBJECT_TYPE", CHARACTER_DATA);
addColumn(t, "PRIVILEGE_TYPE", CHARACTER_DATA);
// not null
addColumn(t, "IS_GRANTABLE", YES_OR_NO);
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[ROLE_USAGE_GRANTS].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }, 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, OBJECT_CATALOG, OBJECT_SCHEMA, OBJECT_NAME, " + "OBJECT_TYPE, PRIVILEGE_TYPE, IS_GRANTABLE " + "FROM INFORMATION_SCHEMA.USAGE_PRIVILEGES " + "JOIN INFORMATION_SCHEMA.APPLICABLE_ROLES ON GRANTEE = ROLE_NAME;");
t.insertSys(store, rs);
sys.close();
return t;
}
Aggregations