Search in sources :

Example 16 with Session

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;
}
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 17 with Session

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;
}
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 18 with Session

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;
}
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)

Example 19 with Session

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;
}
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 20 with Session

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;
}
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

Session (org.hsqldb_voltpatches.Session)24 Result (org.hsqldb_voltpatches.result.Result)18 Table (org.hsqldb_voltpatches.Table)17 HsqlName (org.hsqldb_voltpatches.HsqlNameManager.HsqlName)16 PersistentStore (org.hsqldb_voltpatches.persist.PersistentStore)16 TextTable (org.hsqldb_voltpatches.TextTable)15 EOFException (java.io.EOFException)2 IOException (java.io.IOException)2 Constraint (org.hsqldb_voltpatches.Constraint)2 HsqlException (org.hsqldb_voltpatches.HsqlException)2 ScriptReaderBase (org.hsqldb_voltpatches.scriptio.ScriptReaderBase)2 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 LineNumberReader (java.io.LineNumberReader)1 BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1 SchemaObject (org.hsqldb_voltpatches.SchemaObject)1 Statement (org.hsqldb_voltpatches.Statement)1 DoubleIntIndex (org.hsqldb_voltpatches.lib.DoubleIntIndex)1 HashMappedList (org.hsqldb_voltpatches.lib.HashMappedList)1