Package org.hsqldb_voltpatches.index

Examples of org.hsqldb_voltpatches.index.Index


        bestIndexForColumn = new int[colTypes.length];

        ArrayUtil.fillArray(bestIndexForColumn, -1);

        for (int i = 0; i < indexList.length; i++) {
            Index index     = indexList[i];
            // A VoltDB extension -- Don't consider non-column expression indexes for this purpose.
            // Expression-based indexes are not suitable for row identification.
            if (index.getExpressions() != null) {
                continue;
            }
            // End of VoltDB extension
            int[] cols      = index.getColumns();
            int   colsCount = index.getVisibleColumns();

            if (colsCount == 0) {
                continue;
            }

            if (i == 0) {
                isStrict = true;
            }

            if (bestIndexForColumn[cols[0]] == -1) {
                bestIndexForColumn[cols[0]] = i;
            } else {
                Index existing = indexList[bestIndexForColumn[cols[0]]];

                if (colsCount > existing.getColumns().length) {
                    bestIndexForColumn[cols[0]] = i;
                }
            }

            if (!index.isUnique()) {
View Full Code Here


    public final void createPrimaryIndex(int[] pkcols, Type[] pktypes,
                                         HsqlName name) {

        long id = database.persistentStoreCollection.getNextId();
        Index newindex = new IndexAVL(name, id, this, pkcols, null, null,
                                      pktypes, true, true, true, false);

        try {
            addIndex(newindex);
        } catch (HsqlException e) {}
View Full Code Here

    public final Index createAndAddIndexStructure(HsqlName name,
            int[] columns, boolean[] descending, boolean[] nullsLast,
            boolean unique, boolean constraint, boolean forward) {

        Index newindex = createIndexStructure(name, columns, descending,
                                              nullsLast, unique, constraint,
                                              forward);

        addIndex(newindex);
View Full Code Here

            cols[j= columns[j];
            types[j] = colTypes[cols[j]];
        }

        long id = database.persistentStoreCollection.getNextId();
        Index newIndex = new IndexAVL(name, id, this, cols, descending,
                                      nullsLast, types, false, unique,
                                      constraint, forward);

        return newIndex;
    }
View Full Code Here

    final void addIndex(Index index) {

        int i = 0;

        for (; i < indexList.length; i++) {
            Index current = indexList[i];
            int order = index.getIndexOrderValue()
                        - current.getIndexOrderValue();

            if (order < 0) {
                break;
            }
        }
View Full Code Here

    public final Index createIndex(PersistentStore store, HsqlName name,
                                   int[] columns, boolean[] descending,
                                   boolean[] nullsLast, boolean unique,
                                   boolean constraint, boolean forward) {

        Index newIndex = createAndAddIndexStructure(name, columns, descending,
            nullsLast, unique, constraint, forward);

        return newIndex;
    }
View Full Code Here

        }

        tn.createPrimaryKey(getIndex(0).getName(), pkCols, false);

        for (int i = 1; i < indexList.length; i++) {
            Index idx = indexList[i];

            if (dropIndexes.contains(idx.getName())) {
                continue;
            }

            int[] colarr = ArrayUtil.toAdjustedColumnArray(idx.getColumns(),
                colIndex, adjust);

            // A VoltDB extension to support indexed expressions and assume unique attribute
            Expression[] exprArr = idx.getExpressions();
            boolean assumeUnique = idx.isAssumeUnique();
            // End of VoltDB extension
            idx = tn.createIndexStructure(idx.getName(), colarr,
                                          idx.getColumnDesc(), null,
                                          idx.isUnique(), idx.isConstraint(),
                                          idx.isForward());

            // A VoltDB extension to support indexed expressions and assume unique attribute
            if (exprArr != null) {
                idx = idx.withExpressions(adjustExprs(exprArr, colIndex, adjust));
            }
            idx = idx.setAssumeUnique(assumeUnique);
            // End of VoltDB extension
            tn.addIndex(idx);
        }

        if (index != null) {
View Full Code Here

    OrderedHashSet getContainingIndexNames(int colIndex) {

        OrderedHashSet set = new OrderedHashSet();

        for (int i = 0, size = indexList.length; i < size; i++) {
            Index index = indexList[i];

            if (ArrayUtil.find(index.getColumns(), colIndex) != -1) {
                set.add(index.getName());
            }
        }

        return set;
    }
View Full Code Here

        HsqlName indexName = database.nameManager.newAutoName("IDX_T",
            getSchemaName(), getName(), SchemaObject.INDEX);

        try {
            Index index = createAndAddIndexStructure(indexName, columns, null,
                null, false, false, false);

            return index;
        } catch (Throwable t) {
            return null;
View Full Code Here

            case TableBase.SYSTEM_SUBQUERY :
            case TableBase.SYSTEM_TABLE :
            case TableBase.VIEW_TABLE :
            case TableBase.TEMP_TABLE : {
                Index index = createIndexForColumns(cols);

                return index;
            }
        }
View Full Code Here

TOP

Related Classes of org.hsqldb_voltpatches.index.Index

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.