Imported GNU Classpath 0.90
[official-gcc.git] / libjava / classpath / java / sql / ResultSetMetaData.java
blob5a62c549e1ec98262b8a535caed9dffaadec4ee9
1 /* ResultSetMetaData.java -- Returns information about the ResultSet
2 Copyright (C) 1999, 2000, 2002, 2006 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package java.sql;
41 /**
42 * This interface provides a mechanism for obtaining information about
43 * the columns that are present in a <code>ResultSet</code>.
45 * <p> Note that in this class column indices start at 1, not 0.</p>
47 * @author Aaron M. Renn (arenn@urbanophile.com)
49 public interface ResultSetMetaData
51 /**
52 * The column does not allow NULL's.
54 int columnNoNulls = 0;
56 /**
57 * The column allows NULL's.
59 int columnNullable = 1;
61 /**
62 * It is unknown whether or not the column allows NULL's.
64 int columnNullableUnknown = 2;
66 /**
67 * This method returns the number of columns in the result set.
69 * @return The number of columns in the result set.
70 * @exception SQLException If an error occurs.
72 int getColumnCount() throws SQLException;
74 /**
75 * This method test whether or not the column is an auto-increment column.
76 * Auto-increment columns are read-only.
78 * @param columnIndex The index of the column to test.
79 * @return <code>true</code> if the column is auto-increment, <code>false</code>
80 * otherwise.
81 * @exception SQLException If an error occurs.
83 boolean isAutoIncrement(int columnIndex) throws SQLException;
85 /**
86 * This method tests whether or not a column is case sensitive in its values.
88 * @param columnIndex The index of the column to test.
89 * @return <code>true</code> if the column value is case sensitive,
90 * <code>false</code> otherwise.
91 * @exception SQLException If an error occurs.
93 boolean isCaseSensitive(int columnIndex) throws SQLException;
95 /**
96 * This method tests whether not the specified column can be used in
97 * a WHERE clause.
99 * @param columnIndex The index of the column to test.
100 * @return <code>true</code> if the column may be used in a WHERE clause,
101 * <code>false</code> otherwise.
102 * @exception SQLException If an error occurs.
104 boolean isSearchable(int columnIndex) throws SQLException;
107 * This method tests whether or not the column stores a monetary value.
109 * @param columnIndex The index of the column to test.
110 * @return <code>true</code> if the column contains a monetary value,
111 * <code>false</code> otherwise.
112 * @exception SQLException If an error occurs.
114 boolean isCurrency(int columnIndex) throws SQLException;
117 * This method returns a value indicating whether or not the specified
118 * column may contain a NULL value.
120 * @param columnIndex The index of the column to test.
121 * @return A constant indicating whether or not the column can contain NULL,
122 * which will be one of <code>columnNoNulls</code>,
123 * <code>columnNullable</code>, or <code>columnNullableUnknown</code>.
124 * @exception SQLException If an error occurs.
126 int isNullable(int columnIndex) throws SQLException;
129 * This method tests whether or not the value of the specified column
130 * is signed or unsigned.
132 * @param columnIndex The index of the column to test.
133 * @return <code>true</code> if the column value is signed, <code>false</code>
134 * otherwise.
135 * @exception SQLException If an error occurs.
137 boolean isSigned(int columnIndex) throws SQLException;
140 * This method returns the maximum number of characters that can be used
141 * to display a value in this column.
143 * @param columnIndex The index of the column to check.
144 * @return The maximum number of characters that can be used to display a
145 * value for this column.
146 * @exception SQLException If an error occurs.
148 int getColumnDisplaySize(int columnIndex) throws SQLException;
151 * This method returns a string that should be used as a caption for this
152 * column for user display purposes.
154 * @param columnIndex The index of the column to check.
155 * @return A display string for the column.
156 * @exception SQLException If an error occurs.
158 String getColumnLabel(int columnIndex) throws SQLException;
161 * This method returns the name of the specified column.
163 * @param columnIndex The index of the column to return the name of.
164 * @return The name of the column.
165 * @exception SQLException If an error occurs.
167 String getColumnName(int columnIndex) throws SQLException;
170 * This method returns the name of the schema that contains the specified
171 * column.
173 * @param columnIndex The index of the column to check the schema name for.
174 * @return The name of the schema that contains the column.
175 * @exception SQLException If an error occurs.
177 String getSchemaName(int columnIndex) throws SQLException;
180 * This method returns the precision of the specified column, which is the
181 * number of decimal digits it contains.
183 * @param columnIndex The index of the column to check the precision on.
184 * @return The precision of the specified column.
185 * @exception SQLException If an error occurs.
187 int getPrecision(int columnIndex) throws SQLException;
190 * This method returns the scale of the specified column, which is the
191 * number of digits to the right of the decimal point.
193 * @param columnIndex The index column to check the scale of.
194 * @return The scale of the column.
195 * @exception SQLException If an error occurs.
197 int getScale(int columnIndex) throws SQLException;
200 * This method returns the name of the table containing the specified
201 * column.
203 * @param columnIndex The index of the column to check the table name for.
204 * @return The name of the table containing the column.
205 * @exception SQLException If an error occurs.
207 String getTableName(int columnIndex) throws SQLException;
210 * This method returns the name of the catalog containing the specified
211 * column.
213 * @param columnIndex The index of the column to check the catalog name for.
214 * @return The name of the catalog containing the column.
215 * @exception SQLException If an error occurs.
217 String getCatalogName(int columnIndex) throws SQLException;
220 * This method returns the SQL type of the specified column. This will
221 * be one of the constants from <code>Types</code>.
223 * @param columnIndex The index of the column to check the SQL type of.
224 * @return The SQL type for this column.
225 * @exception SQLException If an error occurs.
226 * @see Types
228 int getColumnType(int columnIndex) throws SQLException;
231 * This method returns the name of the SQL type for this column.
233 * @param columnIndex The index of the column to check the SQL type name for.
234 * @return The name of the SQL type for this column.
235 * @exception SQLException If an error occurs.
237 String getColumnTypeName(int columnIndex) throws SQLException;
240 * This method tests whether or not the specified column is read only.
242 * @param columnIndex The index of the column to check.
243 * @return <code>true</code> if the column is read only, <code>false</code>
244 * otherwise.
245 * @exception SQLException If an error occurs.
247 boolean isReadOnly(int columnIndex) throws SQLException;
250 * This method tests whether or not the column may be writable. This
251 * does not guarantee that a write will be successful.
253 * @param columnIndex The index of the column to check for writability.
254 * @return <code>true</code> if the column may be writable,
255 * <code>false</code> otherwise.
256 * @exception SQLException If an error occurs.
258 boolean isWritable(int columnIndex) throws SQLException;
261 * This method tests whether or not the column is writable. This
262 * does guarantee that a write will be successful.
264 * @param columnIndex The index of the column to check for writability.
265 * @return <code>true</code> if the column is writable,
266 * <code>false</code> otherwise.
267 * @exception SQLException If an error occurs.
269 boolean isDefinitelyWritable(int columnIndex) throws SQLException;
272 * This method returns the name of the Java class which will be used to
273 * create objects representing the data in this column.
275 * @param columnIndex The index of the column to check.
276 * @return The name of the Java class that will be used for values in
277 * this column.
278 * @exception SQLException If an error occurs.
280 String getColumnClassName(int columnIndex) throws SQLException;