use of org.hsqldb_voltpatches.Table in project voltdb by VoltDB.
the class DataFileDefrag method updateTableIndexRoots.
/**
* called from outside after the complete end of defrag
*/
void updateTableIndexRoots() {
HsqlArrayList allTables = database.schemaManager.getAllTables();
for (int i = 0, size = allTables.size(); i < size; i++) {
Table t = (Table) allTables.get(i);
if (t.getTableType() == TableBase.CACHED_TABLE) {
int[] rootsArray = rootsList[i];
t.setIndexRoots(rootsArray);
}
}
}
use of org.hsqldb_voltpatches.Table in project voltdb by VoltDB.
the class LobManager method createSchema.
public void createSchema() {
sysLobSession = database.sessionManager.getSysLobSession();
Session session = sysLobSession;
InputStream fis = getClass().getResourceAsStream(resourceFileName);
InputStreamReader reader = null;
try {
reader = new InputStreamReader(fis, "ISO-8859-1");
} catch (Exception e) {
}
LineNumberReader lineReader = new LineNumberReader(reader);
LineGroupReader lg = new LineGroupReader(lineReader, starters);
HashMappedList map = lg.getAsMap();
lg.close();
String sql = (String) map.get("/*lob_schema_definition*/");
Statement statement = session.compileStatement(sql);
Result result = statement.execute(session);
Table table = database.schemaManager.getTable(session, "BLOCKS", "SYSTEM_LOBS");
// table.isTransactional = false;
getLob = session.compileStatement(getLobSQL);
getLobPart = session.compileStatement(getLobPartSQL);
createLob = session.compileStatement(createLobSQL);
createLobPart = session.compileStatement(createLobPartSQL);
divideLobPart = session.compileStatement(divideLobPartSQL);
deleteLob = session.compileStatement(deleteLobSQL);
deleteLobPart = session.compileStatement(deleteLobPartSQL);
setLobLength = session.compileStatement(updateLobLengthSQL);
setLobUsage = session.compileStatement(updateLobUsageSQL);
getNextLobId = session.compileStatement(getNextLobIdSQL);
}
use of org.hsqldb_voltpatches.Table in project voltdb by VoltDB.
the class DatabaseInformationMain method INFORMATION_SCHEMA_CATALOG_NAME.
// -----------------------------------------------------------------------------
// SQL SCHEMATA BASE TABLE
/**
* Retrieves a <code>Table</code> object naming the accessible catalogs
* defined within this database. <p>
*
* Each row is a catalog name description with the following column: <p>
*
* <pre class="SqlCodeExample">
* TABLE_CAT VARCHAR catalog name
* </pre> <p>
*
* @return a <code>Table</code> object naming the accessible
* catalogs defined within this database
*/
final Table INFORMATION_SCHEMA_CATALOG_NAME() {
Table t = sysTables[INFORMATION_SCHEMA_CATALOG_NAME];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[INFORMATION_SCHEMA_CATALOG_NAME]);
// not null
addColumn(t, "CATALOG_NAME", SQL_IDENTIFIER);
// order: TABLE_CAT
// true PK
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[INFORMATION_SCHEMA_CATALOG_NAME].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0 }, true);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
Object[] row = t.getEmptyRowData();
row[0] = database.getCatalogName().name;
t.insertSys(store, row);
return t;
}
use of org.hsqldb_voltpatches.Table in project voltdb by VoltDB.
the class DatabaseInformationMain method SYSTEM_TABLES.
/**
* Retrieves a <code>Table</code> object describing the accessible
* tables defined within this database. <p>
*
* Each row is a table description with the following columns: <p>
*
* <pre class="SqlCodeExample">
* TABLE_CAT VARCHAR table catalog
* TABLE_SCHEM VARCHAR table schema
* TABLE_NAME VARCHAR table name
* TABLE_TYPE VARCHAR {"TABLE" | "VIEW" |
* "SYSTEM TABLE" | "GLOBAL TEMPORARY"}
* REMARKS VARCHAR comment on the table.
* TYPE_CAT VARCHAR table type catalog (not implemented).
* TYPE_SCHEM VARCHAR table type schema (not implemented).
* TYPE_NAME VARCHAR table type name (not implemented).
* SELF_REFERENCING_COL_NAME VARCHAR designated "identifier" column of
* typed table (not implemented).
* REF_GENERATION VARCHAR {"SYSTEM" | "USER" |
* "DERIVED" | NULL } (not implemented)
* HSQLDB_TYPE VARCHAR HSQLDB-specific type:
* {"MEMORY" | "CACHED" | "TEXT" | ...}
* READ_ONLY BOOLEAN TRUE if table is read-only,
* else FALSE.
* COMMIT_ACTION VARCHAR "PRESERVE" or "DELETE" for temp tables,
* else NULL
* </pre> <p>
*
* @return a <code>Table</code> object describing the accessible
* tables defined within this database
*/
final Table SYSTEM_TABLES() {
Table t = sysTables[SYSTEM_TABLES];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[SYSTEM_TABLES]);
// -------------------------------------------------------------
// required
// -------------------------------------------------------------
addColumn(t, "TABLE_CAT", SQL_IDENTIFIER);
addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER);
// not null
addColumn(t, "TABLE_NAME", SQL_IDENTIFIER);
// not null
addColumn(t, "TABLE_TYPE", CHARACTER_DATA);
addColumn(t, "REMARKS", CHARACTER_DATA);
// -------------------------------------------------------------
// JDBC 3.0
// -------------------------------------------------------------
addColumn(t, "TYPE_CAT", SQL_IDENTIFIER);
addColumn(t, "TYPE_SCHEM", SQL_IDENTIFIER);
addColumn(t, "TYPE_NAME", SQL_IDENTIFIER);
addColumn(t, "SELF_REFERENCING_COL_NAME", SQL_IDENTIFIER);
addColumn(t, "REF_GENERATION", CHARACTER_DATA);
// -------------------------------------------------------------
// extended
// ------------------------------------------------------------
addColumn(t, "HSQLDB_TYPE", SQL_IDENTIFIER);
// not null
addColumn(t, "READ_ONLY", Type.SQL_BOOLEAN);
// not null
addColumn(t, "COMMIT_ACTION", CHARACTER_DATA);
// ------------------------------------------------------------
// order TABLE_TYPE, TABLE_SCHEM and TABLE_NAME
// added for unique: TABLE_CAT
// false PK, as TABLE_SCHEM and/or TABLE_CAT may be null
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[SYSTEM_TABLES].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 3, 1, 2, 0 }, false);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
// intermediate holders
Iterator tables;
Table table;
Object[] row;
HsqlName accessKey;
DITableInfo ti;
// column number mappings
// JDBC 1
final int itable_cat = 0;
final int itable_schem = 1;
final int itable_name = 2;
final int itable_type = 3;
final int iremark = 4;
// JDBC 3.0
final int itype_cat = 5;
final int itype_schem = 6;
final int itype_name = 7;
final int isref_cname = 8;
final int iref_gen = 9;
// hsqldb ext
final int ihsqldb_type = 10;
final int iread_only = 11;
final int icommit_action = 12;
// Initialization
tables = allTables();
ti = new DITableInfo();
// Do it.
while (tables.hasNext()) {
table = (Table) tables.next();
if (!isAccessibleTable(table)) {
continue;
}
ti.setTable(table);
row = t.getEmptyRowData();
row[itable_cat] = database.getCatalogName().name;
row[itable_schem] = table.getSchemaName().name;
row[itable_name] = ti.getName();
row[itable_type] = ti.getJDBCStandardType();
row[iremark] = ti.getRemark();
row[ihsqldb_type] = ti.getHsqlType();
row[iread_only] = ti.isReadOnly();
row[icommit_action] = table.isTemp() ? (table.onCommitPreserve() ? "PRESERVE" : "DELETE") : null;
t.insertSys(store, row);
}
return t;
}
use of org.hsqldb_voltpatches.Table in project voltdb by VoltDB.
the class DatabaseInformationMain method cacheClear.
/**
* Clears the contents of cached system tables and resets user slots
* to null. <p>
*
*/
protected final void cacheClear() {
int i = sysTables.length;
while (i-- > 0) {
Table t = sysTables[i];
if (t != null) {
t.clearAllData(session);
}
sysTableSessions[i] = null;
}
isDirty = false;
}
Aggregations