📄 ditypeinfo.java
字号:
case Types.DATALINK : case Types.DATE : case Types.OTHER : case Types.TIME : case Types.TIMESTAMP : case Types.XML : return "'"; // or JDBC close escape: "'}"; default : return null; } } /** * Retrieves a localized representation of the type's name, for human * consumption only. <p> * * @return a localized representation of the type's name */ String getLocalName() { if (!locale_set) { setLocale(Locale.getDefault()); } String key = this.getTypeName(); return BundleHandler.getString(hnd_local_names, key); } /** * Retrieves the maximum Short.MAX_VALUE bounded scale supported * for the type. <p> * * @return the maximum Short.MAX_VALUE bounded scale supported * for the type */ Integer getMaxScale() { switch (type) { case Types.BIGINT : case Types.DATE : case Types.TIME : case Types.INTEGER : case Types.SMALLINT : case Types.TINYINT : return ValuePool.getInt(0); case Types.TIMESTAMP : return ValuePool.getInt(6); case Types.DECIMAL : case Types.NUMERIC : return ValuePool.getInt(Short.MAX_VALUE); case Types.FLOAT : case Types.REAL : case Types.DOUBLE : return ValuePool.getInt(306); default : return null; } } /** * Retrieves the maximum Integer.MAX_VALUE bounded scale supported for * the type. <p> * * @return the maximum Integer.MAX_VALUE bounded scale supported * for the type */ Integer getMaxScaleAct() { switch (type) { case Types.DECIMAL : case Types.NUMERIC : return ValuePool.getInt(Integer.MAX_VALUE); default : return getMaxScale(); } } /** * Retrieves the minumum Short.MIN_VALUE bounded scale supported for * the type. <p> * * @return the minumum Short.MIN_VALUE bounded scale * supported for the type */ Integer getMinScale() { switch (type) { case Types.BIGINT : case Types.DATE : case Types.INTEGER : case Types.SMALLINT : case Types.TIME : case Types.TIMESTAMP : case Types.TINYINT : case Types.DECIMAL : case Types.NUMERIC : return ValuePool.getInt(0); case Types.FLOAT : case Types.REAL : case Types.DOUBLE : return ValuePool.getInt(-324); default : return null; } } /** * Retrieves the minumum Integer.MIN_VALUE bounded scale supported * for the type. <p> * * @return the minumum Integer.MIN_VALUE bounded scale supported * for the type */ Integer getMinScaleAct() { return getMinScale(); } /** * Retrieves the DatabaseMetaData default nullability code for * the type. <p> * * @return the DatabaseMetaData nullability code for the type. */ Integer getNullability() { return ValuePool.getInt(columnNullable); } /** * Retrieves the number base which is to be used to interpret the value * reported by getPrecision(). <p> * * @return the number base which is to be used to interpret the * value reported by getPrecision() */ Integer getNumPrecRadix() { switch (type) { case Types.BIGINT : case Types.DECIMAL : case Types.DOUBLE : case Types.INTEGER : case Types.NUMERIC : case Types.REAL : case Types.SMALLINT : case Types.TINYINT : return ValuePool.getInt(10); case Types.FLOAT : return ValuePool.getInt(2); default : return null; } } /** * Retrieves the maximum Integer.MAX_VALUE bounded length or precision for * the type. <p> * * @return the maximum Integer.MAX_VALUE bounded length or * precision for the type */ Integer getPrecision() { int p = Types.getPrecision(type); return p == 0 ? null : ValuePool.getInt(p); } /** * Retrieves the maximum Long.MAX_VALUE bounded length or precision for * the type. <p> * * @return the maximum Long.MAX_VALUE bounded length or * precision for the type */ Long getPrecisionAct() { Integer temp = getPrecision(); if (temp == null) { return ValuePool.getLong(Long.MAX_VALUE); } else { return ValuePool.getLong(temp.longValue()); } } /** * Retrieves the localized remarks (if any) on the type. <p> * * @return the localized remarks on the type. */ String getRemarks() { if (!locale_set) { setLocale(Locale.getDefault()); } String key = this.getTypeName(); return BundleHandler.getString(hnd_remarks, key); } /** * Retrieves the DatabaseMetaData searchability code for the type. <p> * * @return the DatabaseMetaData searchability code for the type */ Integer getSearchability() { return Types.isSearchable(type) ? ValuePool.getInt(typeSearchable) : ValuePool.getInt(typePredNone); } /** * Retrieves the SQL CLI data type code for the type. <p> * * @return the SQL CLI data type code for the type */ Integer getSqlDataType() { // values from SQL200n SQL CLI spec, or DITypes (which in turn borrows // first from java.sql.Types and then SQL200n SQL CLI spec) if there // was no corresponding value in SQL CLI switch (type) { case Types.ARRAY : return ValuePool.getInt(Types.SQL_ARRAY); // SQL_ARRAY case Types.BIGINT : return ValuePool.getInt(Types.SQL_BIGINT); // SQL_BIGINT case Types.BINARY : return ValuePool.getInt(Types.SQL_BLOB); // fredt- was SQL_BIT_VARYING case Types.BOOLEAN : return ValuePool.getInt(Types.SQL_BOOLEAN); // SQL_BOOLEAN case Types.BLOB : return ValuePool.getInt(Types.SQL_BLOB); // SQL_BLOB case Types.CHAR : return ValuePool.getInt(Types.SQL_CHAR); // SQL_CHAR case Types.CLOB : return ValuePool.getInt(Types.SQL_CLOB); // SQL_CLOB case Types.DATALINK : return ValuePool.getInt(Types.SQL_DATALINK); // SQL_DATALINK case Types.DATE : // NO: This is the _concise_ code, whereas what we want to // return here is the Data Type Code column value from // Table 38 in the SQL 200n FCD. This method is used // by DatabaseInformationMain to list the sql type // column in the SYSTEM_TYPEINFO table, which is specified // by JDBC as the sql data type code, not the concise code. // That is why there is a sql datetime sub column // specified as well. // return ValuePool.getInt(Types.SQL_DATE); // fredt - was SQL_DATETIME return ValuePool.getInt(Types.SQL_DATETIME); case Types.DECIMAL : return ValuePool.getInt(Types.SQL_DECIMAL); // SQL_DECIMAL case Types.DISTINCT : return ValuePool.getInt(Types.SQL_UDT); // SQL_UDT case Types.DOUBLE : return ValuePool.getInt(Types.SQL_DOUBLE); // SQL_DOUBLE case Types.FLOAT : return ValuePool.getInt(Types.SQL_FLOAT); // SQL_FLOAT case Types.INTEGER : return ValuePool.getInt(Types.SQL_INTEGER); // SQL_INTEGER case Types.JAVA_OBJECT : return ValuePool.getInt(Types.JAVA_OBJECT); // N/A - maybe SQL_UDT? case Types.LONGVARBINARY : return ValuePool.getInt(Types.SQL_BLOB); // was SQL_BIT_VARYING case Types.LONGVARCHAR : return ValuePool.getInt(Types.SQL_CLOB); // case Types.NULL : return ValuePool.getInt(Types.SQL_ALL_TYPES); // SQL_ALL_TYPES case Types.NUMERIC : return ValuePool.getInt(Types.SQL_NUMERIC); // SQL_NUMERIC case Types.OTHER : return ValuePool.getInt(Types.OTHER); // N/A - maybe SQL_UDT? case Types.REAL : return ValuePool.getInt(Types.SQL_REAL); // SQL_REAL case Types.REF : return ValuePool.getInt(Types.SQL_REF); // SQL_REF case Types.SMALLINT : return ValuePool.getInt(Types.SQL_SMALLINT); // SQL_SMALLINTEGER case Types.STRUCT : return ValuePool.getInt(Types.SQL_UDT); // SQL_UDT case Types.TIME : // NO: This is the _concise_ code, whereas what we want to // return here is the Data Type Code column value from // Table 38 in the SQL 200n FCD. This method is used // by DatabaseInformationMain to list the sql type // column in the SYSTEM_TYPEINFO table, which is specified // by JDBC as the sql data type code, not the concise code. // That is why there is a sql datetime sub column // specified as well. // return ValuePool.getInt(Types.SQL_TIME); // fredt - was SQL_DATETIME return ValuePool.getInt(Types.SQL_DATETIME); case Types.TIMESTAMP : // NO: This is the _concise_ code, whereas what we want to // return here is the Data Type Code column value from // Table 38 in the SQL CLI 200n FCD. This method is used // by DatabaseInformationMain to list the sql type // column in the SYSTEM_TYPEINFO table, which is specified // by JDBC as the sql data type code, not the concise code. // That is why there is a sql datetime sub column // specified as well. // return ValuePool.getInt(Types.SQL_TIMESTAMP); // fredt - was SQL_DATETIME return ValuePool.getInt(Types.SQL_DATETIME); case Types.TINYINT : return ValuePool.getInt(Types.TINYINT); // N/A case Types.VARBINARY : return ValuePool.getInt(Types.SQL_BLOB); // SQL_BIT_VARYING case Types.VARCHAR : return ValuePool.getInt(Types.SQL_VARCHAR); // SQL_VARCHAR case Types.XML : return ValuePool.getInt(Types.SQL_XML); // SQL_XML default : return null; } } /** * Retrieves the SQL CLI datetime subcode for the type. <p> * * @return the SQL CLI datetime subcode for the type */ Integer getSqlDateTimeSub() { switch (type) { case Types.DATE : return ValuePool.getInt(1); case Types.TIME : return ValuePool.getInt(2); case Types.TIMESTAMP : return ValuePool.getInt(3); default : return null; } } /** * Retrieve the fully qualified name of the recommended standard Java * primitive, class or java.sql interface mapping for the type. <p> * * @return the fully qualified name of the recommended standard Java * primitive, class or java.sql interface mapping for * the type */ String getStdMapClsName() { switch (type) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -