Package org.apache.phoenix.schema

Examples of org.apache.phoenix.schema.SequenceKey


    @Override
    public long createSequence(String tenantId, String schemaName, String sequenceName,
            long startWith, long incrementBy, long cacheSize, long minValue, long maxValue,
            boolean cycle, long timestamp) throws SQLException {
        SequenceKey key = new SequenceKey(tenantId, schemaName, sequenceName);
        if (sequenceMap.get(key) != null) {
            throw new SequenceAlreadyExistsException(schemaName, sequenceName);
        }
        sequenceMap.put(key, new SequenceInfo(startWith, incrementBy, minValue, maxValue, 1l, cycle)) ;
        return timestamp;
View Full Code Here


        return timestamp;
    }

    @Override
    public long dropSequence(String tenantId, String schemaName, String sequenceName, long timestamp) throws SQLException {
        SequenceKey key = new SequenceKey(tenantId, schemaName, sequenceName);
        if (sequenceMap.remove(key) == null) {
            throw new SequenceNotFoundException(schemaName, sequenceName);
        }
        return timestamp;
    }
View Full Code Here

        // rather than tenant-specific sequence, as it makes it much easier
        // to cleanup when the physical table is dropped, as we can delete
        // all global sequences leading with <prefix> + physical name.
        String schemaName = VIEW_INDEX_SEQUENCE_PREFIX + physicalName.getString();
        String tableName = tenantId == null ? "" : tenantId;
        return new SequenceKey(null, schemaName, tableName);
    }
View Full Code Here

            return false;
        }
    }
   
    public static void deleteViewIndexSequences(PhoenixConnection connection, PName name) throws SQLException {
        SequenceKey key = getViewIndexSequenceKey(null, name);
        connection.createStatement().executeUpdate("DELETE FROM " + PhoenixDatabaseMetaData.SEQUENCE_TABLE_NAME +
                " WHERE " + PhoenixDatabaseMetaData.TENANT_ID + " IS NULL AND " +
                PhoenixDatabaseMetaData.SEQUENCE_SCHEMA + " = '" + key.getSchemaName() + "'");
       
    }
View Full Code Here

    @Override
    public long createSequence(String tenantId, String schemaName, String sequenceName,
            long startWith, long incrementBy, long cacheSize, long minValue, long maxValue,
            boolean cycle, long timestamp) throws SQLException {
        SequenceKey sequenceKey = new SequenceKey(tenantId, schemaName, sequenceName);
        Sequence newSequences = new Sequence(sequenceKey);
        Sequence sequence = sequenceMap.putIfAbsent(sequenceKey, newSequences);
        if (sequence == null) {
            sequence = newSequences;
        }
View Full Code Here

        }
    }

    @Override
    public long dropSequence(String tenantId, String schemaName, String sequenceName, long timestamp) throws SQLException {
        SequenceKey sequenceKey = new SequenceKey(tenantId, schemaName, sequenceName);
        Sequence newSequences = new Sequence(sequenceKey);
        Sequence sequence = sequenceMap.putIfAbsent(sequenceKey, newSequences);
        if (sequence == null) {
            sequence = newSequences;
        }
View Full Code Here

            isNextSequence = new BitSet();
        }
        PName tenantName = statement.getConnection().getTenantId();
        String tenantId = tenantName == null ? null : tenantName.getString();
        TableName tableName = node.getTableName();
        SequenceKey key = new SequenceKey(tenantId, tableName.getSchemaName(), tableName.getTableName());
        SequenceValueExpression expression = sequenceMap.get(key);
        if (expression == null) {
            int index = sequenceMap.size();
            expression = new SequenceValueExpression(index);
            sequenceMap.put(key, expression);
View Full Code Here

        // rather than tenant-specific sequence, as it makes it much easier
        // to cleanup when the physical table is dropped, as we can delete
        // all global sequences leading with <prefix> + physical name.
        String schemaName = VIEW_INDEX_SEQUENCE_PREFIX + physicalName.getString();
        String tableName = tenantId == null ? "" : tenantId;
        return new SequenceKey(null, schemaName, tableName);
    }
View Full Code Here

            return false;
        }
    }
   
    public static void deleteViewIndexSequences(PhoenixConnection connection, PName name) throws SQLException {
        SequenceKey key = getViewIndexSequenceKey(null, name);
        connection.createStatement().executeUpdate("DELETE FROM " + PhoenixDatabaseMetaData.SEQUENCE_TABLE_NAME +
                " WHERE " + PhoenixDatabaseMetaData.TENANT_ID + " IS NULL AND " +
                PhoenixDatabaseMetaData.SEQUENCE_SCHEMA + " = '" + key.getSchemaName() + "'");
       
    }
View Full Code Here

    }

    @Override
    public long createSequence(String tenantId, String schemaName, String sequenceName, long startWith, long incrementBy, long cacheSize, long timestamp)
            throws SQLException {
        SequenceKey key = new SequenceKey(tenantId, schemaName, sequenceName);
        if (sequenceMap.get(key) != null) {
            throw new SequenceAlreadyExistsException(schemaName, sequenceName);
        }
        sequenceMap.put(key, startWith);
        return timestamp;
View Full Code Here

TOP

Related Classes of org.apache.phoenix.schema.SequenceKey

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.