Package org.hsqldb.store

Examples of org.hsqldb.store.BitMap


        if (maxSize % pageSize != 0) {
            bitSize++;
        }

        bitMap = new BitMap(bitSize);
    }
View Full Code Here


        }
    }

    void scanBitString() {

        BitMap map = new BitMap(32);

        while (true) {
            scanBitStringPart(map);

            if (token.isMalformed) {
                return;
            }

            if (scanSeparator() && charAt(currentPosition) == '\'') {
                continue;
            }

            break;
        }

        token.tokenValue = BinaryData.getBitData(map.getBytes(), map.size());
    }
View Full Code Here

        return data;
    }

    public synchronized BinaryData convertToBit(String s) {

        BitMap map      = new BitMap(32);
        int    bitIndex = map.size();

        reset(s);
        resetState();
        byteOutputStream.reset(byteBuffer);

        for (; currentPosition < limit; currentPosition++) {
            int c = sqlString.charAt(currentPosition);

            if (c == '0') {
                bitIndex++;
            } else if (c == '1') {
                map.set(bitIndex);

                bitIndex++;
            } else {
                token.tokenType   = Tokens.X_MALFORMED_BIT_STRING;
                token.isMalformed = true;

                throw Error.error(ErrorCode.X_22018);
            }
        }

        map.setSize(bitIndex);

        return BinaryData.getBitData(map.getBytes(), map.size());
    }
View Full Code Here

    public static BitMap sqlBitStringToBitMap(String s) throws IOException {

        int    l = s.length();
        int    n;
        int    bitIndex = 0;
        BitMap map      = new BitMap(l);

        for (int j = 0; j < l; j++) {
            char c = s.charAt(j);

            if (c == ' ') {
                continue;
            }

            n = getNibble(c);

            if (n != 0 && n != 1) {
                throw new IOException(
                    "hexadecimal string contains non hex character");    //NOI18N
            }

            if (n == 1) {
                map.set(bitIndex);
            }

            bitIndex++;
        }

        map.setSize(bitIndex);

        return map;
    }
View Full Code Here

        if (maxSize % pageSize != 0) {
            bitSize++;
        }

        bitMap = new BitMap(bitSize);
    }
View Full Code Here

        }
    }

    void scanBitString() {

        BitMap map = new BitMap(32);

        while (true) {
            scanBitStringPart(map);

            if (token.isMalformed) {
                return;
            }

            if (scanSeparator() && charAt(currentPosition) == '\'') {
                continue;
            }

            break;
        }

        token.tokenValue = new BinaryData(map.getBytes(), map.size());
    }
View Full Code Here

        return data;
    }

    public synchronized BinaryData convertToBit(String s) {

        BitMap map      = new BitMap(32);
        int    bitIndex = map.size();

        reset(s);
        resetState();
        byteOutputStream.reset(byteBuffer);

        for (; currentPosition < limit; currentPosition++) {
            int c = sqlString.charAt(currentPosition);

            if (c == '0') {
                bitIndex++;
            } else if (c == '1') {
                map.set(bitIndex);

                bitIndex++;
            } else {
                token.tokenType   = Tokens.X_MALFORMED_BIT_STRING;
                token.isMalformed = true;

                throw Error.error(ErrorCode.X_22018);
            }
        }

        map.setSize(bitIndex);

        return new BinaryData(map.getBytes(), map.size());
    }
View Full Code Here

        }
    }

    HsqlName[] readColumnNames(HsqlName tableName) {

        BitMap         quotedFlags = new BitMap(32);
        OrderedHashSet set         = readColumnNames(quotedFlags, false);
        HsqlName[]     colList     = new HsqlName[set.size()];

        for (int i = 0; i < colList.length; i++) {
            String  name   = (String) set.get(i);
            boolean quoted = quotedFlags.isSet(i);

            colList[i] = database.nameManager.newHsqlName(tableName.schema,
                    name, quoted, SchemaObject.COLUMN, tableName);
        }
View Full Code Here

    protected RangeVariable readTableOrSubquery() {

        Table          table            = null;
        SimpleName     alias            = null;
        OrderedHashSet columnList       = null;
        BitMap         columnNameQuoted = null;
        SimpleName[]   columnNameList   = null;

        if (token.tokenType == Tokens.OPENBRACKET) {
            Expression e = XreadTableSubqueryOrJoinedTable();

            table = e.subQuery.getTable();
        } else {
            table = readTableName();

            if (table.isView()) {
                SubQuery sq = getViewSubquery((View) table);

//                sq.queryExpression = ((View) table).queryExpression;
                table = sq.getTable();
            }
        }

        boolean hasAs = false;

        if (token.tokenType == Tokens.AS) {
            read();
            checkIsNonCoreReservedIdentifier();

            hasAs = true;
        }

        if (isNonCoreReservedIdentifier()) {
            boolean limit = token.tokenType == Tokens.LIMIT
                            || token.tokenType == Tokens.OFFSET;
            int position = getPosition();

            alias = HsqlNameManager.getSimpleName(token.tokenString,
                                                  isDelimitedIdentifier());

            read();

            if (token.tokenType == Tokens.OPENBRACKET) {
                columnNameQuoted = new BitMap(32);
                columnList       = readColumnNames(columnNameQuoted, false);
            } else if (!hasAs && limit) {
                if (token.tokenType == Tokens.QUESTION
                        || token.tokenType == Tokens.X_VALUE) {
                    alias = null;

                    rewind(position);
                }
            }
        }

        if (columnList != null) {
            if (table.getColumnCount() != columnList.size()) {
                throw Error.error(ErrorCode.X_42593);
            }

            columnNameList = new SimpleName[columnList.size()];

            for (int i = 0; i < columnList.size(); i++) {
                SimpleName name =
                    HsqlNameManager.getSimpleName((String) columnList.get(i),
                                                  columnNameQuoted.isSet(i));

                columnNameList[i] = name;
            }
        }
View Full Code Here

TOP

Related Classes of org.hsqldb.store.BitMap

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.