source: trunk/src/gcc/libjava/java/sql/ResultSetMetaData.java@ 192

Last change on this file since 192 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 11.6 KB
Line 
1/* ResultSetMetaData.java -- Returns information about the ResultSet
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4This file is part of GNU Classpath.
5
6GNU Classpath is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Classpath is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Classpath; see the file COPYING. If not, write to the
18Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1902111-1307 USA.
20
21Linking this library statically or dynamically with other modules is
22making a combined work based on this library. Thus, the terms and
23conditions of the GNU General Public License cover the whole
24combination.
25
26As a special exception, the copyright holders of this library give you
27permission to link this library with independent modules to produce an
28executable, regardless of the license terms of these independent
29modules, and to copy and distribute the resulting executable under
30terms of your choice, provided that you also meet, for each linked
31independent module, the terms and conditions of the license of that
32module. An independent module is a module which is not derived from
33or based on this library. If you modify this library, you may extend
34this exception to your version of the library, but you are not
35obligated to do so. If you do not wish to do so, delete this
36exception statement from your version. */
37
38
39package java.sql;
40
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.
46 *
47 * @author Aaron M. Renn ([email protected])
48 */
49public interface ResultSetMetaData
50{
51
52/**
53 * The column does not allow NULL's.
54 */
55public static final int columnNoNulls = 0;
56
57/**
58 * The column allows NULL's.
59 */
60public static final int columnNullable = 1;
61
62/**
63 * It is unknown whether or not the column allows NULL's.
64 */
65public static final int columnNullableUnknown = 2;
66
67/*************************************************************************/
68
69/**
70 * This method returns the number of columns in the result set.
71 *
72 * @return The number of columns in the result set.
73 *
74 * @exception SQLException If an error occurs.
75 */
76public abstract int
77getColumnCount() throws SQLException;
78
79/*************************************************************************/
80
81/**
82 * This method test whether or not the column is an auto-increment column.
83 * Auto-increment columns are read-only.
84 *
85 * @param index The index of the column to test.
86 *
87 * @return <code>true</code> if the column is auto-increment, <code>false</code>
88 * otherwise.
89 *
90 * @exception SQLException If an error occurs.
91 */
92public abstract boolean
93isAutoIncrement(int index) throws SQLException;
94
95/*************************************************************************/
96
97/**
98 * This method tests whether or not a column is case sensitive in its values.
99 *
100 * @param index The index of the column to test.
101 *
102 * @return <code>true</code> if the column value is case sensitive,
103 * <code>false</code> otherwise.
104 *
105 * @exception SQLException If an error occurs.
106 */
107public abstract boolean
108isCaseSensitive(int index) throws SQLException;
109
110/*************************************************************************/
111
112/**
113 * This method tests whether not the specified column can be used in
114 * a WHERE clause.
115 *
116 * @param index The index of the column to test.
117 *
118 * @return <code>true</code> if the column may be used in a WHERE clause,
119 * <code>false</code> otherwise.
120 *
121 * @exception SQLException If an error occurs.
122 */
123public abstract boolean
124isSearchable(int index) throws SQLException;
125
126/*************************************************************************/
127
128/**
129 * This method tests whether or not the column stores a monetary value.
130 *
131 * @param index The index of the column to test.
132 *
133 * @return <code>true</code> if the column contains a monetary value,
134 * <code>false</code> otherwise.
135 *
136 * @exception SQLException If an error occurs.
137 */
138public abstract boolean
139isCurrency(int index) throws SQLException;
140
141/*************************************************************************/
142
143/**
144 * This method returns a value indicating whether or not the specified
145 * column may contain a NULL value.
146 *
147 * @param index The index of the column to test.
148 *
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>.
152 *
153 * @exception SQLException If an error occurs.
154 */
155public abstract int
156isNullable(int index) throws SQLException;
157
158/*************************************************************************/
159
160/**
161 * This method tests whether or not the value of the specified column
162 * is signed or unsigned.
163 *
164 * @param index The index of the column to test.
165 *
166 * @return <code>true</code> if the column value is signed, <code>false</code>
167 * otherwise.
168 *
169 * @exception SQLException If an error occurs.
170 */
171public abstract boolean
172isSigned(int index) throws SQLException;
173
174/*************************************************************************/
175
176/**
177 * This method returns the maximum number of characters that can be used
178 * to display a value in this column.
179 *
180 * @param index The index of the column to check.
181 *
182 * @return The maximum number of characters that can be used to display a
183 * value for this column.
184 *
185 * @exception SQLException If an error occurs.
186 */
187public abstract int
188getColumnDisplaySize(int index) throws SQLException;
189
190/*************************************************************************/
191
192/**
193 * This method returns a string that should be used as a caption for this
194 * column for user display purposes.
195 *
196 * @param index The index of the column to check.
197 *
198 * @return A display string for the column.
199 *
200 * @exception SQLException If an error occurs.
201 */
202public abstract String
203getColumnLabel(int index) throws SQLException;
204
205/*************************************************************************/
206
207/**
208 * This method returns the name of the specified column.
209 *
210 * @param index The index of the column to return the name of.
211 *
212 * @return The name of the column.
213 *
214 * @exception SQLException If an error occurs.
215 */
216public abstract String
217getColumnName(int index) throws SQLException;
218
219/*************************************************************************/
220
221/**
222 * This method returns the name of the schema that contains the specified
223 * column.
224 *
225 * @param index The index of the column to check the schema name for.
226 *
227 * @return The name of the schema that contains the column.
228 *
229 * @exception SQLException If an error occurs.
230 */
231public abstract String
232getSchemaName(int index) throws SQLException;
233
234/*************************************************************************/
235
236/**
237 * This method returns the precision of the specified column, which is the
238 * number of decimal digits it contains.
239 *
240 * @param index The index of the column to check the precision on.
241 *
242 * @return The precision of the specified column.
243 *
244 * @exception SQLException If an error occurs.
245 */
246public abstract int
247getPrecision(int index) throws SQLException;
248
249/*************************************************************************/
250
251/**
252 * This method returns the scale of the specified column, which is the
253 * number of digits to the right of the decimal point.
254 *
255 * @param index The index column to check the scale of.
256 *
257 * @return The scale of the column.
258 *
259 * @exception SQLException If an error occurs.
260 */
261public abstract int
262getScale(int index) throws SQLException;
263
264/*************************************************************************/
265
266/**
267 * This method returns the name of the table containing the specified
268 * column.
269 *
270 * @param index The index of the column to check the table name for.
271 *
272 * @return The name of the table containing the column.
273 *
274 * @exception SQLException If an error occurs.
275 */
276public abstract String
277getTableName(int index) throws SQLException;
278
279/*************************************************************************/
280
281/**
282 * This method returns the name of the catalog containing the specified
283 * column.
284 *
285 * @param index The index of the column to check the catalog name for.
286 *
287 * @return The name of the catalog containing the column.
288 *
289 * @exception SQLException If an error occurs.
290 */
291public abstract String
292getCatalogName(int index) throws SQLException;
293
294/*************************************************************************/
295
296/**
297 * This method returns the SQL type of the specified column. This will
298 * be one of the constants from <code>Types</code>.
299 *
300 * @param index The index of the column to check the SQL type of.
301 *
302 * @return The SQL type for this column.
303 *
304 * @exception SQLException If an error occurs.
305 *
306 * @see Types
307 */
308public abstract int
309getColumnType(int index) throws SQLException;
310
311/*************************************************************************/
312
313/**
314 * This method returns the name of the SQL type for this column.
315 *
316 * @param index The index of the column to check the SQL type name for.
317 *
318 * @return The name of the SQL type for this column.
319 *
320 * @exception SQLException If an error occurs.
321 */
322public abstract String
323getColumnTypeName(int index) throws SQLException;
324
325/*************************************************************************/
326
327/**
328 * This method tests whether or not the specified column is read only.
329 *
330 * @param index The index of the column to check.
331 *
332 * @return <code>true</code> if the column is read only, <code>false</code>
333 * otherwise.
334 *
335 * @exception SQLException If an error occurs.
336 */
337public abstract boolean
338isReadOnly(int index) throws SQLException;
339
340/*************************************************************************/
341
342/**
343 * This method tests whether or not the column may be writable. This
344 * does not guarantee that a write will be successful.
345 *
346 * @param index The index of the column to check for writability.
347 *
348 * @return <code>true</code> if the column may be writable,
349 * <code>false</code> otherwise.
350 *
351 * @exception SQLException If an error occurs.
352 */
353public abstract boolean
354isWritable(int index) throws SQLException;
355
356/*************************************************************************/
357
358/**
359 * This method tests whether or not the column is writable. This
360 * does guarantee that a write will be successful.
361 *
362 * @param index The index of the column to check for writability.
363 *
364 * @return <code>true</code> if the column is writable,
365 * <code>false</code> otherwise.
366 *
367 * @exception SQLException If an error occurs.
368 */
369public abstract boolean
370isDefinitelyWritable(int index) throws SQLException;
371
372/*************************************************************************/
373
374/**
375 * This method returns the name of the Java class which will be used to
376 * create objects representing the data in this column.
377 *
378 * @param index The index of the column to check.
379 *
380 * @return The name of the Java class that will be used for values in
381 * this column.
382 *
383 * @exception SQLException If an error occurs.
384 */
385public abstract String
386getColumnClassName(int index) throws SQLException;
387
388} // interface ResultSetMetaData
389
Note: See TracBrowser for help on using the repository browser.