1
/* ResultSetMetaData.java -- Returns information about the ResultSet
2
Copyright (C) 1999, 2000 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)
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
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
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. */
42
* This interface provides a mechanism for obtaining information about
43
* the columns that are present in a <code>ResultSet</code>.
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
53
* The column does not allow NULL's.
55
public static final int columnNoNulls = 0;
58
* The column allows NULL's.
60
public static final int columnNullable = 1;
63
* It is unknown whether or not the column allows NULL's.
65
public static final int columnNullableUnknown = 2;
67
/*************************************************************************/
70
* This method returns the number of columns in the result set.
72
* @return The number of columns in the result set.
74
* @exception SQLException If an error occurs.
77
getColumnCount() throws SQLException;
79
/*************************************************************************/
82
* This method test whether or not the column is an auto-increment column.
83
* Auto-increment columns are read-only.
85
* @param index The index of the column to test.
87
* @return <code>true</code> if the column is auto-increment, <code>false</code>
90
* @exception SQLException If an error occurs.
92
public abstract boolean
93
isAutoIncrement(int index) throws SQLException;
95
/*************************************************************************/
98
* This method tests whether or not a column is case sensitive in its values.
100
* @param index The index of the column to test.
102
* @return <code>true</code> if the column value is case sensitive,
103
* <code>false</code> otherwise.
105
* @exception SQLException If an error occurs.
107
public abstract boolean
108
isCaseSensitive(int index) throws SQLException;
110
/*************************************************************************/
113
* This method tests whether not the specified column can be used in
116
* @param index The index of the column to test.
118
* @return <code>true</code> if the column may be used in a WHERE clause,
119
* <code>false</code> otherwise.
121
* @exception SQLException If an error occurs.
123
public abstract boolean
124
isSearchable(int index) throws SQLException;
126
/*************************************************************************/
129
* This method tests whether or not the column stores a monetary value.
131
* @param index The index of the column to test.
133
* @return <code>true</code> if the column contains a monetary value,
134
* <code>false</code> otherwise.
136
* @exception SQLException If an error occurs.
138
public abstract boolean
139
isCurrency(int index) throws SQLException;
141
/*************************************************************************/
144
* This method returns a value indicating whether or not the specified
145
* column may contain a NULL value.
147
* @param index The index of the column to test.
149
* @return A constant indicating whether or not the column can contain NULL,
150
* which will be one of <code>columnNoNulls</code>,
151
* <code>columnNullable</code>, or <code>columnNullableUnknown</code>.
153
* @exception SQLException If an error occurs.
156
isNullable(int index) throws SQLException;
158
/*************************************************************************/
161
* This method tests whether or not the value of the specified column
162
* is signed or unsigned.
164
* @param index The index of the column to test.
166
* @return <code>true</code> if the column value is signed, <code>false</code>
169
* @exception SQLException If an error occurs.
171
public abstract boolean
172
isSigned(int index) throws SQLException;
174
/*************************************************************************/
177
* This method returns the maximum number of characters that can be used
178
* to display a value in this column.
180
* @param index The index of the column to check.
182
* @return The maximum number of characters that can be used to display a
183
* value for this column.
185
* @exception SQLException If an error occurs.
188
getColumnDisplaySize(int index) throws SQLException;
190
/*************************************************************************/
193
* This method returns a string that should be used as a caption for this
194
* column for user display purposes.
196
* @param index The index of the column to check.
198
* @return A display string for the column.
200
* @exception SQLException If an error occurs.
202
public abstract String
203
getColumnLabel(int index) throws SQLException;
205
/*************************************************************************/
208
* This method returns the name of the specified column.
210
* @param index The index of the column to return the name of.
212
* @return The name of the column.
214
* @exception SQLException If an error occurs.
216
public abstract String
217
getColumnName(int index) throws SQLException;
219
/*************************************************************************/
222
* This method returns the name of the schema that contains the specified
225
* @param index The index of the column to check the schema name for.
227
* @return The name of the schema that contains the column.
229
* @exception SQLException If an error occurs.
231
public abstract String
232
getSchemaName(int index) throws SQLException;
234
/*************************************************************************/
237
* This method returns the precision of the specified column, which is the
238
* number of decimal digits it contains.
240
* @param index The index of the column to check the precision on.
242
* @return The precision of the specified column.
244
* @exception SQLException If an error occurs.
247
getPrecision(int index) throws SQLException;
249
/*************************************************************************/
252
* This method returns the scale of the specified column, which is the
253
* number of digits to the right of the decimal point.
255
* @param index The index column to check the scale of.
257
* @return The scale of the column.
259
* @exception SQLException If an error occurs.
262
getScale(int index) throws SQLException;
264
/*************************************************************************/
267
* This method returns the name of the table containing the specified
270
* @param index The index of the column to check the table name for.
272
* @return The name of the table containing the column.
274
* @exception SQLException If an error occurs.
276
public abstract String
277
getTableName(int index) throws SQLException;
279
/*************************************************************************/
282
* This method returns the name of the catalog containing the specified
285
* @param index The index of the column to check the catalog name for.
287
* @return The name of the catalog containing the column.
289
* @exception SQLException If an error occurs.
291
public abstract String
292
getCatalogName(int index) throws SQLException;
294
/*************************************************************************/
297
* This method returns the SQL type of the specified column. This will
298
* be one of the constants from <code>Types</code>.
300
* @param index The index of the column to check the SQL type of.
302
* @return The SQL type for this column.
304
* @exception SQLException If an error occurs.
309
getColumnType(int index) throws SQLException;
311
/*************************************************************************/
314
* This method returns the name of the SQL type for this column.
316
* @param index The index of the column to check the SQL type name for.
318
* @return The name of the SQL type for this column.
320
* @exception SQLException If an error occurs.
322
public abstract String
323
getColumnTypeName(int index) throws SQLException;
325
/*************************************************************************/
328
* This method tests whether or not the specified column is read only.
330
* @param index The index of the column to check.
332
* @return <code>true</code> if the column is read only, <code>false</code>
335
* @exception SQLException If an error occurs.
337
public abstract boolean
338
isReadOnly(int index) throws SQLException;
340
/*************************************************************************/
343
* This method tests whether or not the column may be writable. This
344
* does not guarantee that a write will be successful.
346
* @param index The index of the column to check for writability.
348
* @return <code>true</code> if the column may be writable,
349
* <code>false</code> otherwise.
351
* @exception SQLException If an error occurs.
353
public abstract boolean
354
isWritable(int index) throws SQLException;
356
/*************************************************************************/
359
* This method tests whether or not the column is writable. This
360
* does guarantee that a write will be successful.
362
* @param index The index of the column to check for writability.
364
* @return <code>true</code> if the column is writable,
365
* <code>false</code> otherwise.
367
* @exception SQLException If an error occurs.
369
public abstract boolean
370
isDefinitelyWritable(int index) throws SQLException;
372
/*************************************************************************/
375
* This method returns the name of the Java class which will be used to
376
* create objects representing the data in this column.
378
* @param index The index of the column to check.
380
* @return The name of the Java class that will be used for values in
383
* @exception SQLException If an error occurs.
385
public abstract String
386
getColumnClassName(int index) throws SQLException;
388
} // interface ResultSetMetaData