Search in sources :

Example 1 with Result

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;
}
Also used : HsqlArrayList(org.hsqldb_voltpatches.lib.HsqlArrayList) Result(org.hsqldb_voltpatches.result.Result)

Example 2 with 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;
}
Also used : Result(org.hsqldb_voltpatches.result.Result)

Example 3 with 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;
}
Also used : Table(org.hsqldb_voltpatches.Table) TextTable(org.hsqldb_voltpatches.TextTable) PersistentStore(org.hsqldb_voltpatches.persist.PersistentStore) HsqlName(org.hsqldb_voltpatches.HsqlNameManager.HsqlName) Constraint(org.hsqldb_voltpatches.Constraint) Session(org.hsqldb_voltpatches.Session) Result(org.hsqldb_voltpatches.result.Result)

Example 4 with Result

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;
}
Also used : Table(org.hsqldb_voltpatches.Table) TextTable(org.hsqldb_voltpatches.TextTable) PersistentStore(org.hsqldb_voltpatches.persist.PersistentStore) HsqlName(org.hsqldb_voltpatches.HsqlNameManager.HsqlName) Session(org.hsqldb_voltpatches.Session) Result(org.hsqldb_voltpatches.result.Result)

Example 5 with Result

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;
}
Also used : Table(org.hsqldb_voltpatches.Table) TextTable(org.hsqldb_voltpatches.TextTable) PersistentStore(org.hsqldb_voltpatches.persist.PersistentStore) HsqlName(org.hsqldb_voltpatches.HsqlNameManager.HsqlName) Session(org.hsqldb_voltpatches.Session) Result(org.hsqldb_voltpatches.result.Result)

Aggregations

Result (org.hsqldb_voltpatches.result.Result)83 Session (org.hsqldb_voltpatches.Session)18 PersistentStore (org.hsqldb_voltpatches.persist.PersistentStore)16 HsqlName (org.hsqldb_voltpatches.HsqlNameManager.HsqlName)15 Table (org.hsqldb_voltpatches.Table)14 ResultLob (org.hsqldb_voltpatches.result.ResultLob)13 TextTable (org.hsqldb_voltpatches.TextTable)12 ResultMetaData (org.hsqldb_voltpatches.result.ResultMetaData)11 RowSetNavigator (org.hsqldb_voltpatches.navigator.RowSetNavigator)10 HsqlException (org.hsqldb_voltpatches.HsqlException)5 RowSetNavigatorData (org.hsqldb_voltpatches.navigator.RowSetNavigatorData)4 EOFException (java.io.EOFException)3 RowSetNavigatorClient (org.hsqldb_voltpatches.navigator.RowSetNavigatorClient)3 IOException (java.io.IOException)2 RangeIteratorBase (org.hsqldb_voltpatches.RangeVariable.RangeIteratorBase)2 Statement (org.hsqldb_voltpatches.Statement)2 HashMappedList (org.hsqldb_voltpatches.lib.HashMappedList)2 HsqlArrayList (org.hsqldb_voltpatches.lib.HsqlArrayList)2 HsqlByteArrayInputStream (org.hsqldb_voltpatches.lib.HsqlByteArrayInputStream)2 Iterator (org.hsqldb_voltpatches.lib.Iterator)2