Package org.hsqldb_voltpatches.types

Examples of org.hsqldb_voltpatches.types.Type


        final int       declared_numeric_scale     = 31;
        Iterator it =
            database.schemaManager.databaseObjectIterator(SchemaObject.DOMAIN);

        while (it.hasNext()) {
            Type distinct = (Type) it.next();

            if (!distinct.isDistinctType()) {
                continue;
            }

            Object[] data = t.getEmptyRowData();

            data[user_defined_type_catalog= database.getCatalogName().name;
            data[user_defined_type_schema]   = distinct.getSchemaName().name;
            data[user_defined_type_name]     = distinct.getName().name;
            data[data_type]                  = distinct.getFullNameString();
            data[declared_data_type]         = distinct.getFullNameString();
            data[user_defined_type_category] = "DISTINCT";
            data[is_instantiable]            = "YES";
            data[is_final]                   = "YES";
            data[ordering_form]              = "FULL";
            data[source_dtd_identifier]      = distinct.getFullNameString();

            if (distinct.isCharacterType()) {
                data[character_maximum_length] =
                    ValuePool.getLong(distinct.precision);
                data[character_octet_length] =
                    ValuePool.getLong(distinct.precision * 2);
                data[character_set_catalog] = database.getCatalogName().name;
                data[character_set_schema] =
                    ((CharacterType) distinct).getCharacterSet()
                        .getSchemaName().name;
                data[character_set_name] =
                    ((CharacterType) distinct).getCharacterSet().getName()
                        .name;
                data[collation_catalog] = database.getCatalogName().name;
                data[collation_schema] =
                    ((CharacterType) distinct).getCollation().getSchemaName()
                        .name;
                data[collation_name] =
                    ((CharacterType) distinct).getCollation().getName().name;
            } else if (distinct.isNumberType()) {
                data[numeric_precision] =
                    ValuePool.getLong(((NumberType) distinct).getPrecision());
                data[declared_numeric_precision] =
                    ValuePool.getLong(((NumberType) distinct).getPrecision());

                if (distinct.typeCode != Types.SQL_DOUBLE) {
                    data[numeric_scale] = ValuePool.getLong(distinct.scale);
                    data[declared_numeric_scale] =
                        ValuePool.getLong(distinct.scale);
                }

                data[numeric_precision_radix] = ValuePool.getLong(
                    ((NumberType) distinct).getPrecisionRadix());
            } else if (distinct.isBooleanType()) {}
            else if (distinct.isDateTimeType()) {
                data[datetime_precision] = ValuePool.getLong(distinct.scale);
            } else if (distinct.isIntervalType()) {
                data[interval_precision] =
                    ValuePool.getLong(distinct.precision);
                data[interval_type]      = distinct.getFullNameString();
                data[datetime_precision] = ValuePool.getLong(distinct.scale);
            } else if (distinct.isBinaryType()) {
                data[character_maximum_length] =
                    ValuePool.getLong(distinct.precision);
                data[character_octet_length] =
                    ValuePool.getLong(distinct.precision);
            } else if (distinct.isBitType()) {
                data[character_maximum_length] =
                    ValuePool.getLong(distinct.precision);
                data[character_octet_length] =
                    ValuePool.getLong(distinct.precision);
            }
View Full Code Here


     */
    public int getPrecision(int param) throws SQLException {

        checkRange(param);

        Type type = rmd.columnTypes[--param];

        if (type.isDateTimeType()) {
            return type.displaySize();
        } else {
            long size = type.precision;

            if (size > Integer.MAX_VALUE) {
                size = 0;
View Full Code Here

    public synchronized Object getObject(
            int parameterIndex) throws SQLException {

        checkGetParameterIndex(parameterIndex);

        Type sourceType = parameterTypes[parameterIndex - 1];

        switch (sourceType.typeCode) {

            case Types.SQL_DATE :
                return getDate(parameterIndex);
View Full Code Here

     *    invalid, or the conversion cannot be performed
     */
    private Object getColumnInType(int columnIndex,
                                   Type targetType) throws SQLException {

        Type   sourceType;
        Object value;

        sourceType = parameterTypes[--columnIndex];
        value      = parameterValues[columnIndex];

        if (trackNull(value)) {
            return null;
        }

        if (sourceType.typeCode != targetType.typeCode) {
            try {
                value = targetType.convertToTypeJDBC(session, value,
                        sourceType);
            } catch (HsqlException e) {
                String stringValue =
                    (value instanceof Number || value instanceof String
                     || value instanceof java.util.Date) ? value.toString()
                        : "instance of " + value.getClass().getName();
                String msg = "from SQL type " + sourceType.getNameString()
                             + " to " + targetType.getJDBCClassName()
                             + ", value: " + stringValue;
                HsqlException err = Error.error(ErrorCode.X_42561, msg);

                throw Util.sqlException(err, e);
View Full Code Here

    }

    private void resolveRowTypes() {

        for (int i = 0; i < nodes[LEFT].nodeDataTypes.length; i++) {
            Type leftType  = nodes[LEFT].nodeDataTypes[i];
            Type rightType = nodes[RIGHT].nodeDataTypes[i];

            if (leftType.typeComparisonGroup
                    != rightType.typeComparisonGroup) {
                throw Error.error(ErrorCode.X_42562);
            } else if (leftType.isDateTimeType()) {
                if (leftType.isDateTimeTypeWithZone()
                        ^ rightType.isDateTimeTypeWithZone()) {
                    nodes[LEFT].nodes[i] =
                        new ExpressionOp(nodes[LEFT].nodes[i]);
                    nodes[LEFT].nodeDataTypes[i] =
                        nodes[LEFT].nodes[i].dataType;
                }
View Full Code Here

        if (nodes[RIGHT].opType == OpTypes.TABLE) {}

        nodes[LEFT].nodeDataTypes = new Type[nodes[LEFT].nodes.length];

        for (int i = 0; i < nodes[LEFT].nodeDataTypes.length; i++) {
            Type type = nodes[LEFT].nodes[i].dataType;

            if (type == null) {
                type = nodes[RIGHT].nodeDataTypes[i];
            }
            // A VoltDB extension to support "IN ?"
            else if (i == 0 && degree == 1 &&
                    nodes[RIGHT].opType == OpTypes.DYNAMIC_PARAM &&
                    nodes[RIGHT].nodeDataTypes != null &&
                    nodes[RIGHT].nodeDataTypes.length == 1 &&
                    nodes[RIGHT].nodeDataTypes[0] == null) {
                if (type.isIntegralType()) {
                    // promote parameter type to vector of BIGINT regardless of exact LHS integer scale.
                    nodes[RIGHT].nodeDataTypes[0] = Type.SQL_BIGINT;
                }
                else {
                    nodes[RIGHT].nodeDataTypes[0] = type;
View Full Code Here

                    }
                }

                routine.setReturnTable(table);
            } else {
                Type type = readTypeDefinition(true);

                routine.setReturnType(type);
            }
        }
View Full Code Here

            return null;
        }

        HsqlName name =
            super.readNewSchemaObjectNameNoCheck(SchemaObject.VARIABLE);
        Type       type = readTypeDefinition(true);
        Expression def  = null;

        if (token.tokenType == Tokens.DEFAULT) {
            read();
View Full Code Here

        if (!isReservedKey()) {
            hsqlName = readNewDependentSchemaObjectName(routine.getName(),
                    SchemaObject.PARAMETER);
        }

        Type typeObject = readTypeDefinition(true);
        ColumnSchema column = new ColumnSchema(hsqlName, typeObject, false,
                                               false, null);

        column.setParameterMode(parameterMode);
View Full Code Here

            case OpTypes.VALUE :
                break;

            case OpTypes.CAST : {
                Type type = nodes[LEFT].dataType;

                if (type != null && !dataType.canConvertFrom(type)) {
                    throw Error.error(ErrorCode.X_42561);
                }
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.