Package org.hsqldb.types

Examples of org.hsqldb.types.Type$TypedComparator


    public synchronized void setBlob(int parameterIndex,
                                     Blob x) throws SQLException {

        checkSetParameterIndex(parameterIndex, false);

        Type outType = parameterTypes[parameterIndex - 1];

        switch (outType.typeCode) {

            case Types.SQL_BINARY :
            case Types.SQL_VARBINARY :
View Full Code Here


    public synchronized void setClob(int parameterIndex,
                                     Clob x) throws SQLException {

        checkSetParameterIndex(parameterIndex, false);

        Type outType = parameterTypes[parameterIndex - 1];

        switch (outType.typeCode) {

            case Types.SQL_CHAR :
            case Types.SQL_VARCHAR :
View Full Code Here

    public synchronized void setArray(int parameterIndex,
                                      Array x) throws SQLException {

        checkParameterIndex(parameterIndex);

        Type type = this.parameterMetaData.columnTypes[parameterIndex -1];

        if (!type.isArrayType()) {
            throw Util.sqlException(ErrorCode.X_42561);
        }

        if (x == null) {
            checkSetParameterIndex(parameterIndex, false);
            setParameter(parameterIndex, null);
            return;
        }

        Object[] data = null;

        if (x instanceof JDBCArray) {
           data = (Object[]) ((JDBCArray) x).getArrayInternal();
        } else {
            Object object = x.getArray();

            if (object instanceof Object[]) {
                Type baseType  = type.collectionBaseType();
                Object[] array = (Object[]) object;
                data           = new Object[array.length];

                for (int i = 0; i < data.length; i++) {
                    data[i] = baseType.convertJavaToSQL(session, array[i]);
                }

            } else {

                // if foreign data is not Object[]
View Full Code Here

            parameterValues[i] = null;

            return;
        }

        Type outType    = parameterTypes[i];
        long millis = HsqlDateTime.convertToNormalisedDate(x.getTime(), cal);
        int  zoneOffset = HsqlDateTime.getZoneMillis(cal, millis);

        switch (outType.typeCode) {
View Full Code Here

            parameterValues[i] = null;

            return;
        }

        Type     outType    = parameterTypes[i];
        long     millis     = x.getTime();
        int      zoneOffset = 0;
        Calendar calendar   = cal == null ? session.getCalendar()
                : cal;
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

            parameterValues[i] = null;

            return;
        }

        Type     outType    = parameterTypes[i];
        long     millis     = x.getTime();
        int      zoneOffset = 0;
        Calendar calendar   = cal == null ? session.getCalendar()
                : cal;
View Full Code Here

            parameterValues[i] = null;

            return;
        }

        Type outType = parameterTypes[i];

        switch (outType.typeCode) {

            case Types.OTHER :
                try {
                    if (o instanceof Serializable) {
                        o = new JavaObjectData((Serializable) o);

                        break;
                    }
                } catch (HsqlException e) {
                    Util.throwError(e);
                }
                Util.throwError(Error.error(ErrorCode.X_42563));

                break;
            case Types.SQL_BIT :
            case Types.SQL_BIT_VARYING :
                try {
                    if (o instanceof Boolean) {
                        o = outType.convertToDefaultType(session, o);

                        break;
                    }

                    if (o instanceof Integer) {
                        o = outType.convertToDefaultType(session, o);

                        break;
                    }

                    if (o instanceof byte[]) {
                        o = outType.convertToDefaultType(session, o);

                        break;
                    }

                    if (o instanceof String) {
                        o = outType.convertToDefaultType(session, o);

                        break;
                    }
                } catch (HsqlException e) {
                    Util.throwError(e);
                }
                Util.throwError(Error.error(ErrorCode.X_42563));

            // fall through
            case Types.SQL_BINARY :
            case Types.SQL_VARBINARY :
                if (o instanceof byte[]) {
                    o = new BinaryData((byte[]) o, !connection.isNetConn);

                    break;
                }

                try {
                    if (o instanceof String) {
                        o = outType.convertToDefaultType(session, o);

                        break;
                    }
                } catch (HsqlException e) {
                    Util.throwError(e);
                }
                Util.throwError(Error.error(ErrorCode.X_42563));

                break;

            case Types.SQL_ARRAY :
                if ( o instanceof Array) {
                    setArray(i + 1, (Array) o);

                    return;
                }
                Util.throwError(Error.error(ErrorCode.X_42563));

            case Types.SQL_BLOB :
                setBlobParameter(i + 1, o);

                return;
            case Types.SQL_CLOB :
                setClobParameter(i + 1, o);

                return;
            case Types.SQL_DATE :
            case Types.SQL_TIME_WITH_TIME_ZONE :
            case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
            case Types.SQL_TIME :
            case Types.SQL_TIMESTAMP : {
                try {
                    if (o instanceof String) {
                        o = outType.convertToType(session, o,
                                Type.SQL_VARCHAR);

                        break;
                    }
                    o = outType.convertJavaToSQL(session, o);

                    break;
                } catch (HsqlException e) {
                    Util.throwError(e);
                }
            }

            // fall through
            case Types.TINYINT :
            case Types.SQL_SMALLINT :
            case Types.SQL_INTEGER :
            case Types.SQL_BIGINT :
            case Types.SQL_REAL :
            case Types.SQL_FLOAT :
            case Types.SQL_DOUBLE :
            case Types.SQL_NUMERIC :
            case Types.SQL_DECIMAL :
                try {
                    if (o instanceof String) {
                        o = outType.convertToType(session, o,
                                Type.SQL_VARCHAR);

                        break;
                    }
                    o = outType.convertToDefaultType(session, o);

                    break;
                } catch (HsqlException e) {
                    Util.throwError(e);
                }

            // fall through
            default :
                try {
                    o = outType.convertToDefaultType(session, o);

                    break;
                } catch (HsqlException e) {
                    Util.throwError(e);
                }
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(Tokens.T_DOMAIN).append(' ');
                            sb.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

            scope  = ti.getBRIScope();
            pseudo = ti.getBRIPseudo();

            for (int i = 0; i < cols.length; i++) {
                ColumnSchema column = table.getColumn(i);
                Type         type   = types[i];

                if (translateDTI) {
                    if (type.isIntervalType()) {
                        type = CharacterType.getCharacterType(
                            Types.SQL_VARCHAR, type.displaySize());
                    } else if (type.isDateTimeTypeWithZone()) {
                        type = ((DateTimeType) type)
                            .getDateTimeTypeWithoutZone();
                    }
                }

                row                  = t.getEmptyRowData();
                row[iscope]          = scope;
                row[icolumn_name]    = column.getName().name;
                row[idata_type] = ValuePool.getInt(type.getJDBCTypeCode());
                row[itype_name]      = type.getNameString();
                row[icolumn_size] = ValuePool.getInt(type.getJDBCPrecision());
                row[ibuffer_length= null;
                row[idecimal_digits] = type.getJDBCScale();
                row[ipseudo_column= pseudo;
                row[itable_cat]      = tableCatalog;
                row[itable_schem]    = tableSchema;
                row[itable_name]     = tableName;
                row[inullable] = ValuePool.getInt(column.getNullability());
View Full Code Here

TOP

Related Classes of org.hsqldb.types.Type$TypedComparator

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.