Package org.hsqldb_voltpatches.types

Examples of org.hsqldb_voltpatches.types.Type


    void resolveTypesPartTwo(Session session) {

        resolveGroups();

        for (int i = 0; i < unionColumnMap.length; i++) {
            Type type = unionColumnTypes[unionColumnMap[i]];

            if (type == null) {
                throw Error.error(ErrorCode.X_42567);
            }
View Full Code Here


                                hsqlname.getSchemaQualifiedStatementName());
                        }
                        break;

                    case SchemaObject.DOMAIN :
                        Type domain =
                            (Type) granteeManager.database.schemaManager
                                .findSchemaObject(hsqlname.name,
                                                  hsqlname.schema.name,
                                                  SchemaObject.DOMAIN);

                        if (domain != null) {
                            sb.append(Tokens.T_GRANT).append(' ');
                            sb.append(Tokens.T_USAGE);
                            sb.append(' ').append(Tokens.T_ON).append(' ');
                            sb.append("DOMAIN ").append(
                                hsqlname.getSchemaQualifiedStatementName());
                        }
                        break;

                    case SchemaObject.TYPE :
                        Type type =
                            (Type) granteeManager.database.schemaManager
                                .findSchemaObject(hsqlname.name,
                                                  hsqlname.schema.name,
                                                  SchemaObject.DOMAIN);
View Full Code Here

    public synchronized Number convertToNumber(String s,
            NumberType numberType) {

        Number  number;
        boolean minus = false;
        Type    type;

        reset(s);
        resetState();
        scanWhitespace();
        scanToken();
View Full Code Here

    throws IOException, HsqlException {

        int      l    = colTypes.length;
        Object[] data = new Object[l];
        Object   o;
        Type     type;

        for (int i = 0; i < l; i++) {
            if (checkNull()) {
                continue;
            }

            o    = null;
            type = colTypes[i];

            switch (type.typeCode) {

                case Types.SQL_ALL_TYPES :
                case Types.SQL_CHAR :
                case Types.SQL_VARCHAR :
                case Types.VARCHAR_IGNORECASE :
                    o = readChar(type);
                    break;

                case Types.TINYINT :
                case Types.SQL_SMALLINT :
                    o = readSmallint();
                    break;

                case Types.SQL_INTEGER :
                    o = readInteger();
                    break;

                case Types.SQL_BIGINT :
                    o = readBigint();
                    break;

                //fredt although REAL is now Double, it is read / written in
                //the old format for compatibility
                case Types.SQL_REAL :
                case Types.SQL_FLOAT :
                case Types.SQL_DOUBLE :
                    o = readReal();
                    break;

                case Types.SQL_NUMERIC :
                case Types.SQL_DECIMAL :
                    o = readDecimal(type);
                    break;

                case Types.SQL_DATE :
                    o = readDate(type);
                    break;

                case Types.SQL_TIME :
                case Types.SQL_TIME_WITH_TIME_ZONE :
                    o = readTime(type);
                    break;

                case Types.SQL_TIMESTAMP :
                case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
                    o = readTimestamp(type);
                    break;

                case Types.SQL_INTERVAL_YEAR :
                case Types.SQL_INTERVAL_YEAR_TO_MONTH :
                case Types.SQL_INTERVAL_MONTH :
                    o = readYearMonthInterval(type);
                    break;

                case Types.SQL_INTERVAL_DAY :
                case Types.SQL_INTERVAL_DAY_TO_HOUR :
                case Types.SQL_INTERVAL_DAY_TO_MINUTE :
                case Types.SQL_INTERVAL_DAY_TO_SECOND :
                case Types.SQL_INTERVAL_HOUR :
                case Types.SQL_INTERVAL_HOUR_TO_MINUTE :
                case Types.SQL_INTERVAL_HOUR_TO_SECOND :
                case Types.SQL_INTERVAL_MINUTE :
                case Types.SQL_INTERVAL_MINUTE_TO_SECOND :
                case Types.SQL_INTERVAL_SECOND :
                    o = readDaySecondInterval(type);
                    break;

                case Types.SQL_BOOLEAN :
                    o = readBoole();
                    break;

                case Types.OTHER :
                    o = readOther();
                    break;

                case Types.SQL_CLOB :
                    o = readClob();
                    break;

                case Types.SQL_BLOB :
                    o = readBlob();
                    break;

                case Types.SQL_BINARY :
                case Types.SQL_VARBINARY :
                    o = readBinary();
                    break;

                case Types.SQL_BIT :
                case Types.SQL_BIT_VARYING :
                    o = readBit();
                    break;

                default :
                    throw Error.runtimeError(ErrorCode.U_S0500,
                                             "RowInputBase "
                                             + type.getNameString());
            }

            data[i] = o;
        }
View Full Code Here

        for (int i = 0; i < limit; i++) {
            int    j = hasPK ? primaryKeys[i]
                             : i;
            Object o = data[j];
            Type   t = types[j];

            if (cols != null) {
                ColumnSchema col = (ColumnSchema) cols.get(j);

                writeFieldPrefix();
                writeString(col.getName().statementName);
            }

            if (o == null) {
                writeNull(t);

                continue;
            }

            writeFieldType(t);

            switch (t.typeCode) {

                case Types.SQL_ALL_TYPES :
                    throw Error.runtimeError(
                        ErrorCode.U_S0500, "RowOutputBase");
                case Types.SQL_CHAR :
                case Types.SQL_VARCHAR :
                case Types.VARCHAR_IGNORECASE :
                    writeChar((String) o, t);
                    break;

                case Types.TINYINT :
                case Types.SQL_SMALLINT :
                    writeSmallint((Number) o);
                    break;

                case Types.SQL_INTEGER :
                    writeInteger((Number) o);
                    break;

                case Types.SQL_BIGINT :
                    writeBigint((Number) o);
                    break;

                case Types.SQL_REAL :
                case Types.SQL_FLOAT :
                case Types.SQL_DOUBLE :
                    writeReal((Double) o);
                    break;

                case Types.SQL_NUMERIC :
                case Types.SQL_DECIMAL :
                    writeDecimal((BigDecimal) o, t);
                    break;

                case Types.SQL_BOOLEAN :
                    writeBoolean((Boolean) o);
                    break;

                case Types.SQL_DATE :
                    writeDate((TimestampData) o, t);
                    break;

                case Types.SQL_TIME :
                case Types.SQL_TIME_WITH_TIME_ZONE :
                    writeTime((TimeData) o, t);
                    break;

                case Types.SQL_TIMESTAMP :
                case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
                    writeTimestamp((TimestampData) o, t);
                    break;

                case Types.SQL_INTERVAL_YEAR :
                case Types.SQL_INTERVAL_YEAR_TO_MONTH :
                case Types.SQL_INTERVAL_MONTH :
                    writeYearMonthInterval((IntervalMonthData) o, t);
                    break;

                case Types.SQL_INTERVAL_DAY :
                case Types.SQL_INTERVAL_DAY_TO_HOUR :
                case Types.SQL_INTERVAL_DAY_TO_MINUTE :
                case Types.SQL_INTERVAL_DAY_TO_SECOND :
                case Types.SQL_INTERVAL_HOUR :
                case Types.SQL_INTERVAL_HOUR_TO_MINUTE :
                case Types.SQL_INTERVAL_HOUR_TO_SECOND :
                case Types.SQL_INTERVAL_MINUTE :
                case Types.SQL_INTERVAL_MINUTE_TO_SECOND :
                case Types.SQL_INTERVAL_SECOND :
                    writeDaySecondInterval((IntervalSecondData) o, t);
                    break;

                case Types.OTHER :
                    writeOther((JavaObjectData) o);
                    break;

                case Types.SQL_BLOB :
                    writeBlob((BlobData) o, t);
                    break;

                case Types.SQL_CLOB :
                    writeClob((ClobData) o, t);
                    break;

                case Types.SQL_BINARY :
                case Types.SQL_VARBINARY :
                    writeBinary((BinaryData) o);
                    break;

                case Types.SQL_BIT :
                case Types.SQL_BIT_VARYING :
                    writeBit((BinaryData) o);
                    break;

                default :
                    throw Error.runtimeError(
                        ErrorCode.U_S0500,
                        t.getNameString());
            }
        }
    }
View Full Code Here

         */
        private void getFirstRow() {

            Object value =
                rangeVar.indexCondition.getRightNode().getValue(session);
            Type valueType =
                rangeVar.indexCondition.getRightNode().getDataType();
            Type targetType =
                rangeVar.indexCondition.getLeftNode().getDataType();
            int exprType = rangeVar.indexCondition.getType();
            int range    = 0;

            if (targetType != valueType) {
                range = targetType.compareToTypeRange(value);
            }

            if (range == 0) {
                value = targetType.convertToType(session, value, valueType);
                it = rangeVar.rangeIndex.findFirstRow(session, store, value,
                                                      exprType);
            } else if (range < 0) {
                switch (exprType) {

View Full Code Here

            boolean convertible = true;
            Object[] currentJoinData =
                new Object[rangeVar.rangeIndex.getVisibleColumns()];

            for (int i = 0; i < rangeVar.multiColumnCount; i++) {
                Type valueType =
                    rangeVar.findFirstExpressions[i].getRightNode()
                        .getDataType();
                Type targetType =
                    rangeVar.findFirstExpressions[i].getLeftNode()
                        .getDataType();
                Object value =
                    rangeVar.findFirstExpressions[i].getRightNode().getValue(
                        session);

                if (targetType.compareToTypeRange(value) != 0) {
                    convertible = false;

                    break;
                }

                currentJoinData[i] = targetType.convertToType(session, value,
                        valueType);
            }

            it = convertible
                 ? rangeVar.rangeIndex.findFirstRow(session, store,
View Full Code Here

        }

        // conversion of right argument to character for backward compatibility
        if (nodes[LEFT].dataType.isCharacterType()
                && !nodes[RIGHT].dataType.isCharacterType()) {
            Type newType = CharacterType.getCharacterType(Types.SQL_VARCHAR,
                nodes[RIGHT].dataType.displaySize());

            nodes[RIGHT] = new ExpressionOp(nodes[RIGHT], newType);
        }
View Full Code Here

            // Track whether parameter type hinting is needed for either key or value arguments.
            // For simplicity(?), parameters are not tracked explicitly (by position)
            // or even by category (key vs. value). So, if any parameter hinting is required at all,
            // all arguments get re-checked.
            boolean needParamType = false;
            Type inputTypeInferred = null;
            Type resultTypeInferred = null;

            for (int ii = 0; ii < nodes.length; ii++) {
                Type argType = nodes[ii].dataType;
                if (argType == null) {
                    // A param here means work to do, below.
                    if (nodes[ii].isParam || nodes[ii].valueData == null) {
                        needParamType = true;
                    }
                    continue;
                }
                // Except for the first and the optional last/"default" argument,
                // the arguments alternate between candidate inputs and candidate results.
                if ((((ii % 2) == 0) || ii == nodes.length-1) && (ii != 0)) {
                    // These arguments represent candidate result values
                    // that may hint at the result type or require hinting from the other result values.
                    if (resultTypeInferred == null) {
                        resultTypeInferred = argType; // Take the first result type hint.
                    } else if (resultTypeInferred.typeComparisonGroup != argType.typeComparisonGroup) {
                        resultTypeInferred = Type.SQL_VARCHAR; // Discard contradictory hints.
                    }
                } else {
                    // These arguments represent candidate input keys
                    // that may hint at the input type or may require hinting from the other input keys.
                    if (inputTypeInferred == null) {
                        inputTypeInferred = argType; // Take the first input type hint.
                    } else if (inputTypeInferred.typeComparisonGroup != argType.typeComparisonGroup) {
                        inputTypeInferred = Type.SQL_VARCHAR; // Discard contradictory hints, falling back to string type.
                    }
                }
            }

            // With any luck, there are no parameter "?" arguments to worry about.
            if ( ! needParamType) {
                break;
            }

            // No luck, try to infer the parameters' types.
            // Punt to guessing VARCHAR for lack of better information.
            if (inputTypeInferred == null) {
                inputTypeInferred = Type.SQL_VARCHAR;
            }
            if (resultTypeInferred == null) {
                resultTypeInferred = Type.SQL_VARCHAR;
            }

            for (int ii = 0; ii < nodes.length; ii++) {
                Type argType = nodes[ii].dataType;
                if ((argType != null) || ! (nodes[ii].isParam || nodes[ii].valueData == null)) {
                    continue;
                }
                // This is the same test as above for determining that the argument
                // is a candidate result vs. a candidate input.
View Full Code Here

                    object = table.getConstraint(name.name);

                    table.removeConstraint(name.name);
                } else if (name.parent.type == SchemaObject.DOMAIN) {
                    Type type =
                        (Type) schema.typeLookup.getObject(name.parent.name);

                    object = type.userTypeModifier.getConstraint(name.name);

                    type.userTypeModifier.removeConstraint(name.name);
View Full Code Here

TOP

Related Classes of org.hsqldb_voltpatches.types.Type

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.