use of org.hsqldb_voltpatches.lib.Iterator in project voltdb by VoltDB.
the class SchemaManager method getAllTables.
/**
* Returns an HsqlArrayList containing references to all non-system
* tables and views. This includes all tables and views registered with
* this Database.
*/
public HsqlArrayList getAllTables() {
Iterator schemas = allSchemaNameIterator();
HsqlArrayList alltables = new HsqlArrayList();
while (schemas.hasNext()) {
String name = (String) schemas.next();
HashMappedList current = getTables(name);
alltables.addAll(current.values());
}
return alltables;
}
use of org.hsqldb_voltpatches.lib.Iterator in project voltdb by VoltDB.
the class SchemaManager method dropSchema.
void dropSchema(String name, boolean cascade) {
Schema schema = (Schema) schemaMap.get(name);
if (schema == null) {
throw Error.error(ErrorCode.X_42501, name);
}
if (cascade) {
OrderedHashSet externalReferences = new OrderedHashSet();
getCascadingSchemaReferences(schema.getName(), externalReferences);
removeSchemaObjects(externalReferences);
} else {
if (!schema.isEmpty()) {
throw Error.error(ErrorCode.X_2B000);
}
}
Iterator tableIterator = schema.schemaObjectIterator(SchemaObject.TABLE);
while (tableIterator.hasNext()) {
Table table = ((Table) tableIterator.next());
database.getGranteeManager().removeDbObject(table.getName());
table.releaseTriggers();
database.persistentStoreCollection.releaseStore(table);
}
Iterator sequenceIterator = schema.schemaObjectIterator(SchemaObject.SEQUENCE);
while (sequenceIterator.hasNext()) {
NumberSequence sequence = ((NumberSequence) sequenceIterator.next());
database.getGranteeManager().removeDbObject(sequence.getName());
}
schema.clearStructures();
schemaMap.remove(name);
if (defaultSchemaHsqlName.name.equals(name)) {
HsqlName hsqlName = database.nameManager.newHsqlName(name, false, SchemaObject.SCHEMA);
schema = new Schema(hsqlName, database.getGranteeManager().getDBARole());
defaultSchemaHsqlName = schema.name;
schemaMap.put(schema.name.name, schema);
}
// these are called last and in this particular order
database.getUserManager().removeSchemaReference(name);
database.getSessionManager().removeSchemaReference(schema);
}
use of org.hsqldb_voltpatches.lib.Iterator in project voltdb by VoltDB.
the class SchemaManager method databaseObjectIterator.
public Iterator databaseObjectIterator(int type) {
Iterator it = schemaMap.values().iterator();
Iterator objects = new WrapperIterator();
while (it.hasNext()) {
Schema temp = (Schema) it.next();
objects = new WrapperIterator(objects, temp.schemaObjectIterator(type));
}
return objects;
}
use of org.hsqldb_voltpatches.lib.Iterator in project voltdb by VoltDB.
the class SchemaManager method getSchemas.
HsqlArrayList getSchemas(Grantee grantee) {
HsqlArrayList list = new HsqlArrayList();
Iterator it = schemaMap.values().iterator();
while (it.hasNext()) {
Schema schema = (Schema) it.next();
if (grantee.equals(schema.owner)) {
list.add(schema);
}
}
return list;
}
use of org.hsqldb_voltpatches.lib.Iterator in project voltdb by VoltDB.
the class SchemaManager method getReferencingObjects.
OrderedHashSet getReferencingObjects(HsqlName table, HsqlName column) {
OrderedHashSet set = new OrderedHashSet();
Iterator it = referenceMap.get(table);
while (it.hasNext()) {
HsqlName name = (HsqlName) it.next();
SchemaObject object = getSchemaObject(name);
OrderedHashSet references = object.getReferences();
if (references.contains(column)) {
set.add(name);
}
}
return set;
}
Aggregations