FSF GCC merge 02/23/03
[official-gcc.git] / libjava / java / sql / ResultSetMetaData.java
blob889128975e5db36dc128c9181b5c8729f9ab825a
1 /* ResultSetMetaData.java -- Returns information about the ResultSet
2 Copyright (C) 1999, 2000, 2002 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., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 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>.
44 * <p>
45 * Note that in this class column indexes start at 1, not 0.
47 * @author Aaron M. Renn (arenn@urbanophile.com)
49 public interface ResultSetMetaData
51 /**
52 * The column does not allow NULL's.
54 public static final int columnNoNulls = 0;
56 /**
57 * The column allows NULL's.
59 public static final int columnNullable = 1;
61 /**
62 * It is unknown whether or not the column allows NULL's.
64 public static final 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 public 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 index 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 public boolean isAutoIncrement(int column) throws SQLException;
85 /**
86 * This method tests whether or not a column is case sensitive in its values.
88 * @param index 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 public boolean isCaseSensitive(int column) throws SQLException;
95 /**
96 * This method tests whether not the specified column can be used in
97 * a WHERE clause.
99 * @param index 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 public boolean isSearchable(int column) throws SQLException;
107 * This method tests whether or not the column stores a monetary value.
109 * @param index 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 public boolean isCurrency(int column) throws SQLException;
117 * This method returns a value indicating whether or not the specified
118 * column may contain a NULL value.
120 * @param index 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 public int isNullable(int column) throws SQLException;
129 * This method tests whether or not the value of the specified column
130 * is signed or unsigned.
132 * @param index 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 public boolean isSigned(int column) 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 index 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 public int getColumnDisplaySize(int column) 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 index The index of the column to check.
155 * @return A display string for the column.
156 * @exception SQLException If an error occurs.
158 public String getColumnLabel(int column) throws SQLException;
161 * This method returns the name of the specified column.
163 * @param index 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 public String getColumnName(int column) throws SQLException;
170 * This method returns the name of the schema that contains the specified
171 * column.
173 * @param index 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 public String getSchemaName(int column) throws SQLException;
180 * This method returns the precision of the specified column, which is the
181 * number of decimal digits it contains.
183 * @param index 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 public int getPrecision(int column) 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 index The index column to check the scale of.
194 * @return The scale of the column.
195 * @exception SQLException If an error occurs.
197 public int getScale(int column) throws SQLException;
200 * This method returns the name of the table containing the specified
201 * column.
203 * @param index 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 public String getTableName(int column) throws SQLException;
210 * This method returns the name of the catalog containing the specified
211 * column.
213 * @param index 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 public String getCatalogName(int column) 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 index 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 public int getColumnType(int column) throws SQLException;
231 * This method returns the name of the SQL type for this column.
233 * @param index 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 public String getColumnTypeName(int column) throws SQLException;
240 * This method tests whether or not the specified column is read only.
242 * @param index 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 public boolean isReadOnly(int column) 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 index 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 public boolean isWritable(int column) 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 index 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 public boolean isDefinitelyWritable(int column) 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 index 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 public String getColumnClassName(int column) throws SQLException;