use of org.hsqldb_voltpatches.lib.OrderedHashSet in project voltdb by VoltDB.
the class StatementDMQL method setDatabseObjects.
void setDatabseObjects(CompileContext compileContext) {
parameters = compileContext.getParameters();
setParameters();
setParameterMetaData();
subqueries = compileContext.getSubqueries();
rangeIteratorCount = compileContext.getRangeVarCount();
rangeVariables = compileContext.getRangeVariables();
sequences = compileContext.getSequences();
routines = compileContext.getRoutines();
OrderedHashSet set = new OrderedHashSet();
getTableNamesForRead(set);
for (int i = 0; i < routines.length; i++) {
set.addAll(routines[i].getTableNamesForRead());
}
if (set.size() > 0) {
readTableNames = new HsqlName[set.size()];
set.toArray(readTableNames);
set.clear();
}
getTableNamesForWrite(set);
for (int i = 0; i < routines.length; i++) {
set.addAll(routines[i].getTableNamesForWrite());
}
if (set.size() > 0) {
writeTableNames = new HsqlName[set.size()];
set.toArray(writeTableNames);
}
}
use of org.hsqldb_voltpatches.lib.OrderedHashSet in project voltdb by VoltDB.
the class SchemaObjectSet method getSQL.
String[] getSQL(OrderedHashSet resolved, OrderedHashSet unresolved) {
HsqlArrayList list = new HsqlArrayList();
if (!(map instanceof HashMappedList)) {
return null;
}
if (map.isEmpty()) {
return ValuePool.emptyStringArray;
}
Iterator it = map.values().iterator();
if (type == SchemaObject.FUNCTION || type == SchemaObject.PROCEDURE) {
OrderedHashSet set = new OrderedHashSet();
while (it.hasNext()) {
RoutineSchema routine = (RoutineSchema) it.next();
for (int i = 0; i < routine.routines.length; i++) {
set.add(routine.routines[i]);
}
}
it = set.iterator();
}
while (it.hasNext()) {
SchemaObject object = (SchemaObject) it.next();
OrderedHashSet references = object.getReferences();
if (references != null) {
boolean isResolved = true;
for (int j = 0; j < references.size(); j++) {
HsqlName name = (HsqlName) references.get(j);
if (SqlInvariants.isSchemaNameSystem(name)) {
continue;
}
if (name.type == SchemaObject.COLUMN) {
name = name.parent;
}
if (name.type == SchemaObject.CHARSET) {
// some built-in character sets have no schema
if (name.schema == null) {
continue;
}
}
if (!resolved.contains(name)) {
isResolved = false;
break;
}
}
if (!isResolved) {
unresolved.add(object);
continue;
}
}
resolved.add(object.getName());
if (object.getType() == SchemaObject.TABLE) {
list.addAll(((Table) object).getSQL(resolved, unresolved));
} else {
list.add(object.getSQL());
}
}
String[] array = new String[list.size()];
list.toArray(array);
return array;
}
use of org.hsqldb_voltpatches.lib.OrderedHashSet in project voltdb by VoltDB.
the class SessionData method getSequenceValue.
public Object getSequenceValue(NumberSequence sequence) {
if (sequenceMap == null) {
sequenceMap = new HashMap();
sequenceUpdateSet = new OrderedHashSet();
}
HsqlName key = sequence.getName();
Object value = sequenceMap.get(key);
if (value == null) {
value = sequence.getValueObject();
sequenceMap.put(key, value);
sequenceUpdateSet.add(sequence);
}
return value;
}
use of org.hsqldb_voltpatches.lib.OrderedHashSet in project voltdb by VoltDB.
the class Session method logSequences.
// SEQUENCE current values
void logSequences() {
OrderedHashSet set = sessionData.sequenceUpdateSet;
if (set == null || set.isEmpty()) {
return;
}
for (int i = 0, size = set.size(); i < size; i++) {
NumberSequence sequence = (NumberSequence) set.get(i);
database.logger.writeSequenceStatement(this, sequence);
}
sessionData.sequenceUpdateSet.clear();
}
use of org.hsqldb_voltpatches.lib.OrderedHashSet in project voltdb by VoltDB.
the class SchemaManager method getCascadingReferences.
//
private void getCascadingReferences(HsqlName object, OrderedHashSet set) {
OrderedHashSet newSet = new OrderedHashSet();
Iterator it = referenceMap.get(object);
while (it.hasNext()) {
HsqlName name = (HsqlName) it.next();
boolean added = set.add(name);
if (added) {
newSet.add(name);
}
}
for (int i = 0; i < newSet.size(); i++) {
HsqlName name = (HsqlName) newSet.get(i);
getCascadingReferences(name, set);
}
}
Aggregations