📄 jdbcresultsetmetadata.java
字号:
* * </div> * <!-- end release-specific documentation --> * * @param column the first column is 1, the second is 2, ... * @return <code>true</code> if so; <code>false</code> otherwise * @exception SQLException if a database access error occurs */ public boolean isAutoIncrement(int column) throws SQLException { checkColumn(column); return columnMetaData[--column].isAutoIncrement; } /** * <!-- start generic documentation --> * Indicates whether a column's case matters. <p> * <!-- end generic documentation --> * * <!-- start Release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * HSQLDB 1.7.1 did not report this value accurately. <p> * * Starting with 1.7.2, this feature is better supported. <p> * * This method returns true for any column whose data type is a character * type, with the exception of VARCHAR_IGNORECASE for which it returns * false. It also returns false for any column whose data type is a * not a character data type. <p> * * </div> * <!-- end release-specific documentation --> * * @param column the first column is 1, the second is 2, ... * @return <code>true</code> if so; <code>false</code> otherwise * @exception SQLException if a database access error occurs */ public boolean isCaseSensitive(int column) throws SQLException { checkColumn(column); return columnMetaData[--column].isCaseSensitive; } /** * <!-- start generic documentation --> * Indicates whether the designated column can be used in a where * clause. <p> * <!-- end generic documentation --> * * <!-- start Release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * HSQLDB 1.7.1 did not report this value accurately. <p> * * Starting with 1.7.2, this feature is better supported. <p> * * If the data type of the column is definitely known to be searchable * in any way under HSQLDB, then true is returned, else false. That is, * if the type is reported in DatabaseMetaData.getTypeInfo() as having * DatabaseMetaData.typePredNone or is not reported, then false is * returned, else true. * * </div> * <!-- end release-specific documentation --> * * @param column the first column is 1, the second is 2, ... * @return <code>true</code> if so; <code>false</code> otherwise * @exception SQLException if a database access error occurs */ public boolean isSearchable(int column) throws SQLException { checkColumn(column); return columnMetaData[--column].isSearchable; } /** * <!-- start generic documentation --> * Indicates whether the designated column is a cash value. <p> * <!-- end generic documentation --> * * <!-- start Release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * Up to and including HSQLDB 1.7.2, this method always returns * false. <p> * * This is because true fixed (precision,scale) data types are not yet * supported. That is, DECIMAL and NUMERIC types are implemented * as a thin wrap of java.math.BigDecimal, which cannot, without * additional, as yet unimplemented constraint enforcement code, be * said to be a fixed (precision,scale) types. <p> * * </div> * <!-- end release-specific documentation --> * * @param column the first column is 1, the second is 2, ... * @return <code>true</code> if so; <code>false</code> otherwise * @exception SQLException if a database access error occurs */ public boolean isCurrency(int column) throws SQLException { checkColumn(column); return columnMetaData[--column].isCurrency; } /** * <!-- start generic documentation --> * Indicates the nullability of values in the designated column. <p> * <!-- end generic documentation --> * * <!-- start Release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * Up to 1.7.1, HSQLDB did not report this value accurately. <p> * * Starting with 1.7.2, this feature is better supported. <p> * * columnNullableUnknown is always returned for result set columns that * do not directly represent table column values (i.e. are calculated), * while the corresponding value in SYSTEM_COLUMNS.NULLABLE is returned * for result set columns that do directly represent table column values. <p> * * Those wishing to determine the nullable status of a table column in * isolation from ResultSetMetaData and in a DBMS-independent fashion * can do so by calling DatabaseMetaData.getColumns() with the appropriate * filter values and inspecting the result at the position described in * the API documentation. <p> * * </div> * <!-- end release-specific documentation --> * * @param column the first column is 1, the second is 2, ... * @return the nullability status of the given column; one of * <code>columnNoNulls</code>, * <code>columnNullable</code> or <code>columnNullableUnknown</code> * @exception SQLException if a database access error occurs */ public int isNullable(int column) throws SQLException { checkColumn(column); return columnMetaData[--column].isNullable; } /** * <!-- start generic documentation --> * Indicates whether values in the designated column are signed * numbers. <p> * <!-- end generic documentation --> * * <!-- start Release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * HSQLDB 1.7.1 introduced support for this feature and 1.7.2 * reports identical values (although using a slightly different * implementation).<p> * * </div> * <!-- end release-specific documentation --> * * @param column the first column is 1, the second is 2, ... * @return <code>true</code> if so; <code>false</code> otherwise * @exception SQLException if a database access error occurs */ public boolean isSigned(int column) throws SQLException { checkColumn(column); return columnMetaData[--column].isSigned; } /** * <!-- start generic documentation --> * Indicates the designated column's normal maximum width in * characters. <p> * <!-- end generic documentation --> * * <!-- start Release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * Up to and including HSQLDB 1.7.1, this method always returned * 0, which was intended to convey unknown display size. * Unfortunately, this value is not universally handled by all * clients and in the worst case can cause some applications to * crash. <p> * * Starting with 1.7.2, this feature is better supported. <p> * * The current calculation follows these rules: <p> * * <ol> * <li>Long character types and datetime types:<p> * * The maximum length/precision, repectively.<p> * * <li>CHAR and VARCHAR types: <p> * * <ul> * <li> If the result set column is a direct pass through of a table * column value, column size was declared and the connection is * to an embedded database instance, then the declared value is * returned.<p> * * <li> Otherwise, the value of the system property * hsqldb.max_xxxchar_display_size or the magic value * 32766 (0x7FFE) (tested usable/accepted by most tools and * compatible with assumptions made by java.io read/write * UTF) when the system property is not defined or is not * accessible, due to security constraints. <p> * * </ul> * * It must be noted that the latter value in no way affects the * ability of the HSQLDB JDBC driver to retrieve longer values * and serves only as the current best effort at providing a * value that maximizes usability across a wide range of tools, * given that the HSQLDB database engine does not require the * length to be declared and does not necessarily enforce it, * even if declared. <p> * * <li>Number types: <p> * * The max precision, plus the length of the negation character (1), * plus (if applicable) the maximum number of characters that may * occupy the exponent character sequence. Note that some legacy tools * do not correctly handle BIGINT values of greater than 18 digits. <p> * * <li>BOOLEAN (BIT) type: <p> * * The length of the character sequence "false" (5), the longer of the * two boolean value String representations. <p> * * <li>Remaining types: <p> * * The maximum length/precision, respectively, as reported by * DatabaseMetaData.getTypeInfo(), when applicable. If the maximum * display size is unknown, unknowable or inapplicable, then zero is * returned. <p> * * </ol> * * </div> * <!-- end release-specific documentation --> * * @param column the first column is 1, the second is 2, ... * @return the normal maximum number of characters allowed as the width * of the designated column * @exception SQLException if a database access error occurs */ public int getColumnDisplaySize(int column) throws SQLException { checkColumn(column); return columnMetaData[--column].columnDisplaySize; } /** * <!-- start generic documentation --> * Gets the designated column's suggested title for use in printouts and * displays. <p> * <!-- end generic documentation --> * * <!-- start Release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * In HSQLDB a <code>ResultSet</code> column label is determined in the * following order of precedence:<p> * * <OL> * <LI>The label (alias) specified in the generating query.</LI> * <LI>The name of the underlying column, if no label is specified.<br> * This also applies to aggregate functions.</LI> * <LI>An empty <code>String</code>.</LI> * </OL> <p> * * </div> * <!-- end release-specific documentation --> * * @param column the first column is 1, the second is 2, ... * @return the suggested column title * @exception SQLException if a database access error occurs */ public String getColumnLabel(int column) throws SQLException { checkColumn(column); return columnMetaData[--column].columnLabel; } /** * <!-- start generic documentation --> * Get the designated column's name. <p> * <!-- end generic documentation --> * * <!-- start Release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * In HSQLDB a ResultSet column name is determined in the following * order of prcedence:<p> * * <OL> * <LI>The name of the underlying columnm, if the ResultSet column * represents a column in a table.</LI> * <LI>The label or alias specified in the generating query.</LI> * <LI>An empty <code>String</code>.</LI> * </OL> <p> * * If the <code>jdbc.get_column_name</code> property of the database * has been set to false, this method returns the same value as * {@link #getColumnLabel(int)}.<p> * * </div> * <!-- end release-specific documentation --> * * @param column the first column is 1, the second is 2, ... * @return column name * @exception SQLException if a database access error occurs */ public String getColumnName(int column) throws SQLException { checkColumn(column); column--; return useColumnName ? columnMetaData[column].columnName : columnMetaData[column].columnLabel; } /** * <!-- start generic documentation --> * Get the designated column's table's schema. <p> * <!-- end generic documentation --> * * <!-- start Release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * Up to 1.7.1, HSQLDB did not support the notion of schemas at all, * including schema names in result set metadata; this method always * returned "". <p> * * Staring with 1.7.2, schema name reporting is supported only as an * optional, experimental feature that is disabled by default. * Enabling this feature requires setting the database property * "hsqldb.schemas=true". <p> * * Specifically, when this feature is enabled under 1.7.2, only very * limited support is provided by the engine for executing SQL containing * schema-qualified database object identifiers. That is, when this * feature is enabled under 1.7.2, it is not yet possible in most cases * to use what would otherwise be the correct, canonical SQL calculated * from ResultSetMetaData. <p> * * Regardless, reporting is done only in system table content and is * not yet carried over to ResultSetMetaData. <p> * * For greater detail, see discussion at: * {@link jdbcDatabaseMetaData}. <p> * * </div> * <!-- end release-specific documentation --> * * @param column the first column is 1, the second is 2, ... * @return schema name or "" if not applicable * @exception SQLException if a database access error occurs */ public String getSchemaName(int column) throws SQLException { checkColumn(column);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -