Search in sources :

Example 6 with HashSet

use of org.hsqldb_voltpatches.lib.HashSet in project voltdb by VoltDB.

the class JDBCXADataSource method getPreparedXids.

/**
     * Return the list of transactions currently <I>in prepared or
     * heuristically completed states</I>.
     * Need to find out what non-prepared states they are considering
     * <I>heuristically completed</I>.
     *
     * @see javax.transaction.xa.XAResource#recover(int)
     */
Xid[] getPreparedXids() {
    Iterator it = resources.keySet().iterator();
    Xid curXid;
    HashSet preparedSet = new HashSet();
    while (it.hasNext()) {
        curXid = (Xid) it.next();
        if (((JDBCXAResource) resources.get(curXid)).state == JDBCXAResource.XA_STATE_PREPARED) {
            preparedSet.add(curXid);
        }
    }
    return (Xid[]) preparedSet.toArray(new Xid[0]);
}
Also used : Xid(javax.transaction.xa.Xid) Iterator(org.hsqldb_voltpatches.lib.Iterator) HashSet(org.hsqldb_voltpatches.lib.HashSet)

Example 7 with HashSet

use of org.hsqldb_voltpatches.lib.HashSet in project voltdb by VoltDB.

the class HsqlDatabaseProperties method getUserDefinedPropertyData.

public Set getUserDefinedPropertyData() {
    Set set = new HashSet();
    Iterator it = meta.values().iterator();
    while (it.hasNext()) {
        Object[] row = (Object[]) it.next();
        if (((Integer) row[indexType]).intValue() == SET_PROPERTY) {
            set.add(row);
        }
    }
    return set;
}
Also used : Set(org.hsqldb_voltpatches.lib.Set) HashSet(org.hsqldb_voltpatches.lib.HashSet) Iterator(org.hsqldb_voltpatches.lib.Iterator) HashSet(org.hsqldb_voltpatches.lib.HashSet)

Example 8 with HashSet

use of org.hsqldb_voltpatches.lib.HashSet in project voltdb by VoltDB.

the class DatabaseManager method isServerDB.

static boolean isServerDB(Database db) {
    Iterator it = serverMap.keySet().iterator();
    for (; it.hasNext(); ) {
        Server server = (Server) it.next();
        HashSet databases = (HashSet) serverMap.get(server);
        if (databases.contains(db)) {
            return true;
        }
    }
    return false;
}
Also used : Iterator(org.hsqldb_voltpatches.lib.Iterator) HashSet(org.hsqldb_voltpatches.lib.HashSet)

Example 9 with HashSet

use of org.hsqldb_voltpatches.lib.HashSet in project voltdb by VoltDB.

the class QuerySpecification method getEquiJoinExpressions.

public Expression getEquiJoinExpressions(OrderedHashSet nameSet, RangeVariable rightRange, boolean fullList) {
    HashSet set = new HashSet();
    Expression result = null;
    OrderedHashSet joinColumnNames = new OrderedHashSet();
    for (int i = 0; i < rangeVariableList.size(); i++) {
        RangeVariable range = (RangeVariable) rangeVariableList.get(i);
        HashMappedList columnList = range.rangeTable.columnList;
        for (int j = 0; j < columnList.size(); j++) {
            ColumnSchema column = (ColumnSchema) columnList.get(j);
            String name = range.getColumnAlias(j);
            boolean columnInList = nameSet.contains(name);
            boolean namedJoin = range.namedJoinColumns != null && range.namedJoinColumns.contains(name);
            boolean repeated = !namedJoin && !set.add(name);
            if (repeated && (!fullList || columnInList)) {
                throw Error.error(ErrorCode.X_42578, name);
            }
            if (!columnInList) {
                continue;
            }
            joinColumnNames.add(name);
            int position = rightRange.rangeTable.getColumnIndex(name);
            ColumnSchema rightColumn = rightRange.rangeTable.getColumn(position);
            Expression e = new ExpressionLogical(range, column, rightRange, rightColumn);
            result = ExpressionLogical.andExpressions(result, e);
            ExpressionColumn col = range.getColumnExpression(name);
            if (col == null) {
                col = new ExpressionColumn(new Expression[] { e.getLeftNode(), e.getRightNode() }, name);
                range.addNamedJoinColumnExpression(name, col);
            } else {
                col.nodes = (Expression[]) ArrayUtil.resizeArray(col.nodes, col.nodes.length + 1);
                col.nodes[col.nodes.length - 1] = e.getRightNode();
            }
            rightRange.addNamedJoinColumnExpression(name, col);
        }
    }
    if (fullList && !joinColumnNames.containsAll(nameSet)) {
        throw Error.error(ErrorCode.X_42501);
    }
    rightRange.addNamedJoinColumns(joinColumnNames);
    return result;
}
Also used : HashMappedList(org.hsqldb_voltpatches.lib.HashMappedList) OrderedHashSet(org.hsqldb_voltpatches.lib.OrderedHashSet) OrderedHashSet(org.hsqldb_voltpatches.lib.OrderedHashSet) HashSet(org.hsqldb_voltpatches.lib.HashSet) OrderedIntHashSet(org.hsqldb_voltpatches.lib.OrderedIntHashSet)

Example 10 with HashSet

use of org.hsqldb_voltpatches.lib.HashSet in project voltdb by VoltDB.

the class QuerySpecification method resolveColumnReferencesForAsterisk.

private void resolveColumnReferencesForAsterisk() {
    for (int pos = 0; pos < indexLimitVisible; ) {
        Expression e = (Expression) (exprColumnList.get(pos));
        if (e.getType() == OpTypes.MULTICOLUMN) {
            exprColumnList.remove(pos);
            String tablename = ((ExpressionColumn) e).getTableName();
            if (tablename == null) {
                addAllJoinedColumns(e);
            } else {
                int rangeIndex = e.findMatchingRangeVariableIndex(rangeVariables);
                if (rangeIndex == -1) {
                    throw Error.error(ErrorCode.X_42501, tablename);
                }
                RangeVariable range = rangeVariables[rangeIndex];
                HashSet exclude = getAllNamedJoinColumns();
                range.addTableColumns(e, exclude);
            }
            for (int i = 0; i < e.nodes.length; i++) {
                exprColumnList.add(pos, e.nodes[i]);
                pos++;
            }
            indexLimitVisible += e.nodes.length - 1;
        } else {
            pos++;
        }
    }
}
Also used : OrderedHashSet(org.hsqldb_voltpatches.lib.OrderedHashSet) HashSet(org.hsqldb_voltpatches.lib.HashSet) OrderedIntHashSet(org.hsqldb_voltpatches.lib.OrderedIntHashSet)

Aggregations

HashSet (org.hsqldb_voltpatches.lib.HashSet)14 Iterator (org.hsqldb_voltpatches.lib.Iterator)8 OrderedHashSet (org.hsqldb_voltpatches.lib.OrderedHashSet)6 HashMappedList (org.hsqldb_voltpatches.lib.HashMappedList)3 OrderedIntHashSet (org.hsqldb_voltpatches.lib.OrderedIntHashSet)3 WrapperIterator (org.hsqldb_voltpatches.lib.WrapperIterator)3 Xid (javax.transaction.xa.Xid)1 Constraint (org.hsqldb_voltpatches.Constraint)1 HsqlName (org.hsqldb_voltpatches.HsqlNameManager.HsqlName)1 SchemaObject (org.hsqldb_voltpatches.SchemaObject)1 Table (org.hsqldb_voltpatches.Table)1 TextTable (org.hsqldb_voltpatches.TextTable)1 Set (org.hsqldb_voltpatches.lib.Set)1 DataFileCache (org.hsqldb_voltpatches.persist.DataFileCache)1 PersistentStore (org.hsqldb_voltpatches.persist.PersistentStore)1