use of org.hsqldb_voltpatches.lib.HashMappedList in project voltdb by VoltDB.
the class HSQLInterface method getXMLForTable.
/**
* Get a serialized XML representation of a particular table.
*/
public VoltXMLElement getXMLForTable(String tableName) throws HSQLParseException {
VoltXMLElement xml = emptySchema.duplicate();
// search all the tables XXX probably could do this non-linearly,
// but i don't know about case-insensitivity yet
HashMappedList hsqlTables = getHSQLTables();
for (int i = 0; i < hsqlTables.size(); i++) {
Table table = (Table) hsqlTables.get(i);
String candidateTableName = table.getName().name;
// found the table of interest
if (candidateTableName.equalsIgnoreCase(tableName)) {
VoltXMLElement vxmle = table.voltGetTableXML(sessionProxy);
assert (vxmle != null);
xml.children.add(vxmle);
return xml;
}
}
return null;
}
use of org.hsqldb_voltpatches.lib.HashMappedList in project voltdb by VoltDB.
the class HSQLInterface method getTableNames.
/**
* @return The set of all table/view names in the schema.
*/
private Set<String> getTableNames() {
Set<String> names = new HashSet<>();
// load all the tables
HashMappedList hsqlTables = getHSQLTables();
for (int i = 0; i < hsqlTables.size(); i++) {
Table table = (Table) hsqlTables.get(i);
names.add(table.getName().name);
}
return names;
}
use of org.hsqldb_voltpatches.lib.HashMappedList in project voltdb by VoltDB.
the class HSQLInterface method printTables.
/**
* Debug-only method that prints out the names of all
* tables in the current schema.
*/
@SuppressWarnings("unused")
private void printTables() {
try {
String schemaName = sessionProxy.getSchemaName(null);
System.out.println("*** Tables For Schema: " + schemaName + " ***");
} catch (HsqlException caught) {
caught.printStackTrace();
}
// load all the tables
HashMappedList hsqlTables = getHSQLTables();
for (int i = 0; i < hsqlTables.size(); i++) {
Table table = (Table) hsqlTables.get(i);
System.out.println(table.getName().name);
}
}
use of org.hsqldb_voltpatches.lib.HashMappedList in project voltdb by VoltDB.
the class HSQLInterface method getHSQLTables.
private HashMappedList getHSQLTables() {
try {
String schemaName = null;
schemaName = sessionProxy.getSchemaName(null);
// search all the tables XXX probably could do this non-linearly,
// but i don't know about case-insensitivity yet
SchemaManager schemaManager = sessionProxy.getDatabase().schemaManager;
return schemaManager.getTables(schemaName);
} catch (HsqlException caught) {
m_logger.warn("Unexpected error in the SQL parser", caught);
return new HashMappedList();
}
}
use of org.hsqldb_voltpatches.lib.HashMappedList 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);
}
Aggregations