0N/A/*
2362N/A * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.sql;
0N/A
0N/A/**
0N/A * An object that can be used to get information about the types
0N/A * and properties of the columns in a <code>ResultSet</code> object.
0N/A * The following code fragment creates the <code>ResultSet</code> object rs,
0N/A * creates the <code>ResultSetMetaData</code> object rsmd, and uses rsmd
0N/A * to find out how many columns rs has and whether the first column in rs
0N/A * can be used in a <code>WHERE</code> clause.
0N/A * <PRE>
0N/A *
0N/A * ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
0N/A * ResultSetMetaData rsmd = rs.getMetaData();
0N/A * int numberOfColumns = rsmd.getColumnCount();
0N/A * boolean b = rsmd.isSearchable(1);
0N/A *
0N/A * </PRE>
0N/A */
0N/A
0N/Apublic interface ResultSetMetaData extends Wrapper {
0N/A
0N/A /**
0N/A * Returns the number of columns in this <code>ResultSet</code> object.
0N/A *
0N/A * @return the number of columns
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A int getColumnCount() throws SQLException;
0N/A
0N/A /**
0N/A * Indicates whether the designated column is automatically numbered.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return <code>true</code> if so; <code>false</code> otherwise
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A boolean isAutoIncrement(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Indicates whether a column's case matters.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return <code>true</code> if so; <code>false</code> otherwise
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A boolean isCaseSensitive(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Indicates whether the designated column can be used in a where clause.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return <code>true</code> if so; <code>false</code> otherwise
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A boolean isSearchable(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Indicates whether the designated column is a cash value.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return <code>true</code> if so; <code>false</code> otherwise
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A boolean isCurrency(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Indicates the nullability of values in the designated column.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return the nullability status of the given column; one of <code>columnNoNulls</code>,
0N/A * <code>columnNullable</code> or <code>columnNullableUnknown</code>
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A int isNullable(int column) throws SQLException;
0N/A
0N/A /**
0N/A * The constant indicating that a
0N/A * column does not allow <code>NULL</code> values.
0N/A */
0N/A int columnNoNulls = 0;
0N/A
0N/A /**
0N/A * The constant indicating that a
0N/A * column allows <code>NULL</code> values.
0N/A */
0N/A int columnNullable = 1;
0N/A
0N/A /**
0N/A * The constant indicating that the
0N/A * nullability of a column's values is unknown.
0N/A */
0N/A int columnNullableUnknown = 2;
0N/A
0N/A /**
0N/A * Indicates whether values in the designated column are signed numbers.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return <code>true</code> if so; <code>false</code> otherwise
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A boolean isSigned(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Indicates the designated column's normal maximum width in characters.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return the normal maximum number of characters allowed as the width
0N/A * of the designated column
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A int getColumnDisplaySize(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Gets the designated column's suggested title for use in printouts and
0N/A * displays. The suggested title is usually specified by the SQL <code>AS</code>
0N/A * clause. If a SQL <code>AS</code> is not specified, the value returned from
0N/A * <code>getColumnLabel</code> will be the same as the value returned by the
0N/A * <code>getColumnName</code> method.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return the suggested column title
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A String getColumnLabel(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Get the designated column's name.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return column name
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A String getColumnName(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Get the designated column's table's schema.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return schema name or "" if not applicable
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A String getSchemaName(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Get the designated column's specified column size.
0N/A * For numeric data, this is the maximum precision. For character data, this is the length in characters.
0N/A * For datetime datatypes, this is the length in characters of the String representation (assuming the
0N/A * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype,
0N/A * this is the length in bytes. 0 is returned for data types where the
0N/A * column size is not applicable.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return precision
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A int getPrecision(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Gets the designated column's number of digits to right of the decimal point.
0N/A * 0 is returned for data types where the scale is not applicable.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return scale
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A int getScale(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Gets the designated column's table name.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return table name or "" if not applicable
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A String getTableName(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Gets the designated column's table's catalog name.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return the name of the catalog for the table in which the given column
0N/A * appears or "" if not applicable
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A String getCatalogName(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Retrieves the designated column's SQL type.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return SQL type from java.sql.Types
0N/A * @exception SQLException if a database access error occurs
0N/A * @see Types
0N/A */
0N/A int getColumnType(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Retrieves the designated column's database-specific type name.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return type name used by the database. If the column type is
0N/A * a user-defined type, then a fully-qualified type name is returned.
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A String getColumnTypeName(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Indicates whether the designated column is definitely not writable.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return <code>true</code> if so; <code>false</code> otherwise
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A boolean isReadOnly(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Indicates whether it is possible for a write on the designated column to succeed.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return <code>true</code> if so; <code>false</code> otherwise
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A boolean isWritable(int column) throws SQLException;
0N/A
0N/A /**
0N/A * Indicates whether a write on the designated column will definitely succeed.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return <code>true</code> if so; <code>false</code> otherwise
0N/A * @exception SQLException if a database access error occurs
0N/A */
0N/A boolean isDefinitelyWritable(int column) throws SQLException;
0N/A
0N/A //--------------------------JDBC 2.0-----------------------------------
0N/A
0N/A /**
0N/A * <p>Returns the fully-qualified name of the Java class whose instances
0N/A * are manufactured if the method <code>ResultSet.getObject</code>
0N/A * is called to retrieve a value
0N/A * from the column. <code>ResultSet.getObject</code> may return a subclass of the
0N/A * class returned by this method.
0N/A *
0N/A * @param column the first column is 1, the second is 2, ...
0N/A * @return the fully-qualified name of the class in the Java programming
0N/A * language that would be used by the method
0N/A * <code>ResultSet.getObject</code> to retrieve the value in the specified
0N/A * column. This is the class name used for custom mapping.
0N/A * @exception SQLException if a database access error occurs
0N/A * @since 1.2
0N/A */
0N/A String getColumnClassName(int column) throws SQLException;
0N/A}