Package org.hsqldb_voltpatches.types

Examples of org.hsqldb_voltpatches.types.Type


    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


            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;

        if (cal != null) {
            zoneOffset = HsqlDateTime.getZoneMillis(cal, millis);
View Full Code Here

            parameterValues[i] = null;

            return;
        }

        Type outType    = parameterTypes[i];
        long millis     = x.getTime();
        int  zoneOffset = 0;

        if (cal != null) {
            zoneOffset = HsqlDateTime.getZoneMillis(cal, millis);
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_42565));

                break;
            case Types.SQL_BIT :
            case Types.SQL_BIT_VARYING :
                if (o instanceof Boolean) {
                    if (outType.precision == 1) {
                        byte[] bytes = ((Boolean) o).booleanValue()
                                       ? new byte[] { -0x80 }
                                       : new byte[] { 0 };

                        o = new BinaryData(bytes, 1);

                        break;
                    }
                    Util.throwError(Error.error(ErrorCode.X_42565));
                }

                try {
                    if (o instanceof byte[]) {
                        o = outType.convertToDefaultType(
                            connection.sessionProxy, o);

                        break;
                    }

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

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

            // $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(
                            connection.sessionProxy, o);

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

                break;
            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(connection.sessionProxy, o,
                                Type.SQL_VARCHAR);

                        break;
                    }
                    o = outType.convertJavaToSQL(connection.sessionProxy, 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(connection.sessionProxy, o,
                                Type.SQL_VARCHAR);

                        break;
                    }
                    o = outType.convertToDefaultType(connection.sessionProxy,
                            o);

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

            // $FALL-THROUGH$
            default :
                try {
                    o = outType.convertToDefaultType(connection.sessionProxy,
                            o);

                    break;
                } catch (HsqlException e) {
                    Util.throwError(e);
View Full Code Here

        Iterator it =
            database.schemaManager.databaseObjectIterator(SchemaObject.DOMAIN);

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

            if (!domain.isDomainType()) {
                continue;
            }

            if (!session.getGrantee().isFullyAccessibleByRole(domain)) {
                continue;
            }

            tableConstraints = domain.userTypeModifier.getConstraints();
            constraintCount  = tableConstraints.length;

            for (int i = 0; i < constraintCount; i++) {
                constraint              = tableConstraints[i];
                row                     = t.getEmptyRowData();
                row[constraint_catalog] = database.getCatalogName().name;
                row[constraint_schema= domain.getSchemaName().name;
                row[constraint_name]    = constraint.getName().name;

                try {
                    row[check_clause] = constraint.getCheckSQL();
                } catch (Exception e) {}
View Full Code Here

        Iterator       tables;
        Table          table;
        Object[]       row;
        DITableInfo    ti;
        OrderedHashSet columnList;
        Type           type;

        // Initialization
        tables = allTables();
        ti     = new DITableInfo();

        while (tables.hasNext()) {
            table = (Table) tables.next();
            columnList =
                session.getGrantee().getColumnsForAllPrivileges(table);

            if (columnList.isEmpty()) {
                continue;
            }

            ti.setTable(table);

            columnCount = table.getColumnCount();

            for (int i = 0; i < columnCount; i++) {
                ColumnSchema column = table.getColumn(i);

                type = column.getDataType();

                if (!columnList.contains(column.getName())) {
                    continue;
                }

                row                   = t.getEmptyRowData();
                row[table_cat]        = table.getCatalogName().name;
                row[table_schem]      = table.getSchemaName().name;
                row[table_name]       = table.getName().name;
                row[column_name]      = column.getName().name;
                row[ordinal_position] = ValuePool.getInt(i + 1);
                row[column_default]   = column.getDefaultSQL();
                row[is_nullable]      = column.isNullable() ? "YES"
                                                            : "NO";
                row[data_type]        = type.getFullNameString();

                if (type.isCharacterType()) {
                    row[character_maximum_length] =
                        ValuePool.getLong(type.precision);
                    row[character_octet_length] =
                        ValuePool.getLong(type.precision * 2);
                    row[character_set_catalog] =
                        database.getCatalogName().name;
                    row[character_set_schema] =
                        ((CharacterType) type).getCharacterSet()
                            .getSchemaName().name;
                    row[character_set_name] =
                        ((CharacterType) type).getCharacterSet().getName()
                            .name;
                    row[collation_catalog] = database.getCatalogName().name;
                    row[collation_schema] =
                        ((CharacterType) type).getCollation().getSchemaName()
                            .name;
                    row[collation_name] =
                        ((CharacterType) type).getCollation().getName().name;
                }

                if (type.isBinaryType()) {
                    row[character_maximum_length] =
                        ValuePool.getLong(type.precision);
                    row[character_octet_length] =
                        ValuePool.getLong(type.precision);
                }

                if (type.isNumberType()) {
                    row[numeric_precision] = ValuePool.getLong(type.precision);
                    row[numeric_precision_radix] = ValuePool.getLong(
                        ((NumberType) type).getPrecisionRadix());
                    row[numeric_scale] = ValuePool.getLong(type.scale);
                }

                if (type.isDateTimeType()) {
                    row[datetime_precision] = ValuePool.getLong(type.scale);
                }

                if (type.isIntervalType()) {
                    row[interval_type] =
                        IntervalType.getQualifier(type.typeCode);
                    row[interval_precision] =
                        ValuePool.getLong(type.precision);
                    row[datetime_precision] = ValuePool.getLong(type.scale);
                }

                if (type.isDomainType()) {
                    row[domain_catalog] = database.getCatalogName().name;
                    row[domain_schema= type.getSchemaName().name;
                    row[domain_name]    = type.getName().name;
                }

                if (type.isDistinctType()) {
                    row[udt_catalog] = database.getCatalogName().name;
                    row[udt_schema= type.getSchemaName().name;
                    row[udt_name]    = type.getName().name;
                }

                row[scope_catalog]       = null;
                row[scope_schema]        = null;
                row[scope_name]          = null;
                row[maximum_cardinality] = null;
                row[dtd_identifier]      = null;
                row[is_self_referencing] = null;
                row[is_identity]         = column.isIdentity() ? "YES"
                                                               : "NO";

                if (column.isIdentity()) {
                    NumberSequence sequence = column.getIdentitySequence();

                    row[identity_generation] = sequence.isAlways() ? "ALWAYS"
                                                                   : "BY DEFAULT";
                    row[identity_start] =
                        Long.toString(sequence.getStartValue());
                    row[identity_increment] =
                        Long.toString(sequence.getIncrement());
                    row[identity_maximum] =
                        Long.toString(sequence.getMaxValue());
                    row[identity_minimum] =
                        Long.toString(sequence.getMinValue());
                    row[identity_cycle] = sequence.isCycle() ? "YES"
                                                             : "NO";
                }

                row[is_generated]          = "NEVER";
                row[generation_expression] = null;
                row[is_updatable]          = table.isWritable() ? "YES"
                                                                : "NO";
                row[declared_data_type]    = row[data_type];

                if (type.isNumberType()) {
                    row[declared_numeric_precision] = row[numeric_precision];
                    row[declared_numeric_scale]     = row[numeric_scale];
                }

                t.insertSys(store, row);
View Full Code Here

        //
        Iterator it =
            database.schemaManager.databaseObjectIterator(SchemaObject.DOMAIN);

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

            if (!domain.isDomainType()) {
                continue;
            }

            if (!session.getGrantee().isFullyAccessibleByRole(domain)) {
                continue;
            }

            Constraint[] constraints =
                domain.userTypeModifier.getConstraints();

            for (int i = 0; i < constraints.length; i++) {
                Object[] data = t.getEmptyRowData();

                data[constraint_catalog] = data[domain_catalog] =
                    database.getCatalogName().name;
                data[constraint_schema] = data[domain_schema] =
                    domain.getSchemaName().name;
                data[constraint_name]    = constraints[i].getName().name;
                data[domain_name]        = domain.getName().name;
                data[is_deferrable]      = Tokens.T_NO;
                data[initially_deferred] = Tokens.T_NO;

                t.insertSys(store, data);
            }
View Full Code Here

        //
        Iterator it =
            database.schemaManager.databaseObjectIterator(SchemaObject.DOMAIN);

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

            if (!domain.isDomainType()) {
                continue;
            }

            if (!session.getGrantee().isAccessible(domain)) {
                continue;
            }

            Object[] data = t.getEmptyRowData();

            data[domain_catalog] = database.getCatalogName().name;
            data[domain_schema= domain.getSchemaName().name;
            data[domain_name]    = domain.getName().name;
            data[data_type]      = domain.getFullNameString();

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

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

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

            for (int m = 0; m < specifics.length; m++) {
                row = t.getEmptyRowData();

                Routine specific = specifics[m];
                Type    type     = specific.isProcedure() ? null
                                                          : specific
                                                              .getReturnType();

                //
                row[specific_catalog] = database.getCatalogName().name;
                row[specific_schema= specific.getSchemaName().name;
                row[specific_name]    = specific.getSpecificName().name;
                row[routine_catalog= database.getCatalogName().name;
                row[routine_schema]   = routine.getSchemaName().name;
                row[routine_name]     = specific.getName().name;
                row[routine_type]     = specific.isProcedure() ? "PROCEDURE"
                                                               : "FUNCTION";
                row[module_catalog]   = null;
                row[module_schema]    = null;
                row[module_name]      = null;
                row[udt_catalog]      = null;
                row[udt_schema]       = null;
                row[udt_name]         = null;
                row[data_type]        = type == null ? null
                                                     : type.getNameString();

                if (type != null && type.isCharacterType()) {
                    row[character_maximum_length] =
                        ValuePool.getLong(type.precision);
                    row[character_octet_length] =
                        ValuePool.getLong(type.precision * 2);
                    row[character_set_catalog] =
                        database.getCatalogName().name;
                    row[character_set_schema] =
                        ((CharacterType) type).getCharacterSet()
                            .getSchemaName().name;
                    row[character_set_name] =
                        ((CharacterType) type).getCharacterSet().getName()
                            .name;
                    row[collation_catalog] = database.getCatalogName().name;
                    row[collation_schema] =
                        ((CharacterType) type).getCollation().getSchemaName()
                            .name;
                    row[collation_name] =
                        ((CharacterType) type).getCollation().getName().name;
                }

                if (type != null && type.isNumberType()) {
                    row[numeric_precision] = ValuePool.getLong(type.precision);
                    row[numeric_precision_radix] = ValuePool.getLong(
                        ((NumberType) type).getPrecisionRadix());
                    row[numeric_scale] = ValuePool.getLong(type.precision);
                }

                if (type != null
                        && (type.isIntervalType() || type.isDateTimeType())) {
                    row[datetime_precision] = ValuePool.getLong(type.scale);
                }

                if (type != null && type.isIntervalType()) {
                    row[interval_type] =
                        IntervalType.getQualifier(type.typeCode);
                    row[interval_precision] =
                        ValuePool.getLong(type.precision);
                }
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.