⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ditypeinfo.java

📁 hsqldb是100%java实现的数据库,是一个开放源代码的JAVA数据库 l 具有标准的SQL语法和JAVA接口 l HSQLDB可以自由使用和分发 l 非常简洁和快速的
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
            case Types.ARRAY :                return "java.sql.Array";            case Types.BIGINT :                return "long";            case Types.BINARY :            case Types.LONGVARBINARY :            case Types.VARBINARY :                return "[B";            case Types.BOOLEAN :                return "boolean";            case Types.BLOB :                return "java.sql.Blob";            case Types.CHAR :            case Types.LONGVARCHAR :            case Types.VARCHAR :                return "java.lang.String";            case Types.CLOB :                return "java.sql.Clob";            case Types.DATALINK :                return "java.net.URL";            case Types.DATE :                return "java.sql.Date";            case Types.DECIMAL :            case Types.NUMERIC :                return "java.math.BigDecimal";            case Types.DISTINCT :            case Types.JAVA_OBJECT :            case Types.OTHER :            case Types.XML :    // ???                return "java.lang.Object";            case Types.REAL :                return "float";            case Types.FLOAT :            case Types.DOUBLE :                return "double";            case Types.INTEGER :                return "int";            case Types.NULL :                return "null";            case Types.REF :                return "java.sql.Ref";            case Types.SMALLINT :                return "short";            case Types.STRUCT :                return "java.sql.Struct";            case Types.TIME :                return "java.sql.Time";            case Types.TIMESTAMP :                return "java.sql.Timestamp";            case Types.TINYINT :                return "byte";            default :                return null;        }    }    /**     * Retrieves the data type as an int. <p>     *     * @return the data type as an int     */    int getTypeCode() {        return type;    }    /**     * Retrieves the canonical data type name HSQLDB associates with     * the type.  <p>     *     * This typically matches the designated JDBC name, with one or     * two exceptions. <p>     *     * @return the canonical data type name HSQLDB associates with the type     */    String getTypeName() {        return typeSub == Types.TYPE_SUB_IGNORECASE               ? Types.getTypeName(Types.VARCHAR_IGNORECASE)               : Types.getTypeName(type);    }    /**     * Retrieves the HSQLDB data subtype as an int. <p>     *     * @return the HSQLDB data subtype as an int     */    int getTypeSub() {        return this.typeSub;    }    /**     * Retrieves whether the type can be an IDENTITY type. <p>     *     * @return whether the type can be an IDENTITY type.     */    Boolean isAutoIncrement() {        switch (type) {            case Types.DECIMAL :            case Types.DOUBLE :            case Types.FLOAT :            case Types.NUMERIC :            case Types.REAL :            case Types.SMALLINT :            case Types.TINYINT :                return Boolean.FALSE;            case Types.BIGINT :            case Types.INTEGER :                return Boolean.TRUE;            default :                return null;        }    }    /**     * Retrieves whether the type is case-sensitive in collations and     * comparisons. <p>     *     * @return whether the type is case-sensitive in collations and     *    comparisons.     */    Boolean isCaseSensitive() {        return typeSub == Types.TYPE_SUB_IGNORECASE ? Boolean.FALSE                                                    : Types.isCaseSensitive(                                                    type);    }    /**     * Retrieves whether, under the current release, class path and hosting     * JVM, HSQLDB supports storing this type in table columns. <p>     *     * This value also typically represents whether HSQLDB supports retrieving     * values of this type in the columns of ResultSets.     * @return whether, under the current release, class path     *    and hosting JVM, HSQLDB supports storing this     *    type in table columns     */    Boolean isColStClsSupported() {        return ValuePool.getBoolean(type == Types.NULL ? true                                                       : getColStClsName()                                                       != null);    }    /**     * Retrieves whether values of this type have a fixed precision and     * scale. <p>     *     * @return whether values of this type have a fixed     *    precision and scale.     */    Boolean isFixedPrecisionScale() {        switch (type) {            case Types.BIGINT :            case Types.DECIMAL :            case Types.DOUBLE :            case Types.FLOAT :            case Types.INTEGER :            case Types.NUMERIC :            case Types.REAL :            case Types.SMALLINT :            case Types.TINYINT :                return Boolean.FALSE;            default :                return null;        }    }    /**     * Retrieve whether the fully qualified name reported by getStdMapClsName()     * is supported as a jdbcResultSet.getXXX return type under the current     * HSQLDB release, class path and hosting JVM. <p>     *     * @return whether the fully qualified name reported by getStdMapClsName()     * is supported as a jdbcResultSet.getXXX return type under the current     * HSQLDB release, class path and hosting JVM.     */    Boolean isStdMapClsSupported() {        // its ok to use Class.forName here instead of nameSpace.classForName,        // because all standard map classes are loaded by the boot loader        boolean isSup = false;        switch (type) {            case Types.ARRAY : {                try {                    Class.forName("java.sql.Array");                    isSup = true;                } catch (Exception e) {                    isSup = false;                }                break;            }            case Types.BLOB : {                try {                    Class.forName("java.sql.Blob");                    isSup = true;                } catch (Exception e) {                    isSup = false;                }                break;            }            case Types.CLOB : {                try {                    Class.forName("java.sql.Clob");                    isSup = true;                } catch (Exception e) {                    isSup = false;                }                break;            }            case Types.DISTINCT : {                isSup = false;                break;            }            case Types.REF : {                try {                    Class.forName("java.sql.Ref");                    isSup = true;                } catch (Exception e) {                    isSup = false;                }                break;            }            case Types.STRUCT : {                try {                    Class.forName("java.sql.Struct");                    isSup = true;                } catch (Exception e) {                    isSup = false;                }                break;            }            default : {                isSup = (getStdMapClsName() != null);                break;            }        }        return ValuePool.getBoolean(isSup);    }    /**     * Retrieves whether, under the current release, class path and     * hosting JVM, HSQLDB supports passing or receiving this type as     * the value of a procedure column. <p>     *     * @return whether, under the current release, class path and     *    hosting JVM, HSQLDB supports passing or receiving     *    this type as the value of a procedure column.     */    Boolean isSupportedAsPCol() {        switch (type) {            case Types.NULL :           // - for void return type            case Types.JAVA_OBJECT :    // - for Connection as first parm and            //   Object for return type            case Types.ARRAY :          // - for Object[] row of Trigger.fire()                return Boolean.TRUE;            default :                return isSupportedAsTCol();        }    }    /**     * Retrieves whether, under the current release, class path and     * hosting JVM, HSQLDB supports this as the type of a table     * column. <p>     *     * @return whether, under the current release, class path     *    and hosting JVM, HSQLDB supports this type     *    as the values of a table column     */    Boolean isSupportedAsTCol() {        String columnTypeName;        if (type == Types.NULL) {            return Boolean.FALSE;        }        columnTypeName = Types.getTypeString(type);        return ValuePool.getBoolean(columnTypeName != null);    }    /**     * Retrieves whether values of this type are unsigned. <p>     *     * @return whether values of this type are unsigned     */    Boolean isUnsignedAttribute() {        return Types.isUnsignedAttribute(type);    }    /**     * Assigns the Locale object used to retrieve this object's     * resource bundle dependent values. <p>     *     * @param l the Locale object used to retrieve this object's resource     *      bundle dependent values     */    void setLocale(Locale l) {        if (l == null) {            hnd_create_params = hnd_local_names = hnd_remarks = -1;            locale_set        = false;            return;        }        Locale oldLocale;        synchronized (BundleHandler.class) {            oldLocale = BundleHandler.getLocale();            BundleHandler.setLocale(l);            hnd_create_params =                BundleHandler.getBundleHandle("data-type-create-parameters",                                              null);            hnd_local_names = BundleHandler.getBundleHandle("data-type-names",                    null);            hnd_remarks = BundleHandler.getBundleHandle("data-type-remarks",                    null);            BundleHandler.setLocale(oldLocale);            locale_set = true;        }    }    /**     * Assigns the SQL data type code on which this object is to report. <p>     *     * @param type the SQL data type code on which this object is to report     */    void setTypeCode(int type) {        this.type = type;    }    /**     * Assigns the HSQLDB data subtype code on which this object is     * to report. <p>     *     * @param typeSub the HSQLDB data subtype code on which this object     *      is to report     */    void setTypeSub(int typeSub) {        this.typeSub = typeSub;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -