OSDN Git Service

* Array.java: New file from classpath.
[pf3gnuchains/gcc-fork.git] / libjava / java / sql / ResultSetMetaData.java
1 /* ResultSetMetaData.java -- Returns information about the ResultSet
2    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This file is part of GNU Classpath.
5
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.
10  
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.
15
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.
20
21 As a special exception, if you link this library with other files to
22 produce an executable, this library does not by itself cause the
23 resulting executable to be covered by the GNU General Public License.
24 This exception does not however invalidate any other reasons why the
25 executable file might be covered by the GNU General Public License. */
26
27
28 package java.sql;
29
30 /**
31   * This interface provides a mechanism for obtaining information about
32   * the columns that are present in a <code>ResultSet</code>.
33   * <p>
34   * Note that in this class column indexes start at 1, not 0.
35   *
36   * @author Aaron M. Renn (arenn@urbanophile.com)
37   */
38 public interface ResultSetMetaData
39 {
40
41 /**
42   * The column does not allow NULL's.
43   */
44 public static final int columnNoNulls = 0;
45
46 /**
47   * The column allows NULL's.
48   */
49 public static final int columnNullable = 1;
50
51 /**
52   * It is unknown whether or not the column allows NULL's.
53   */
54 public static final int columnNullableUnknown = 2;
55
56 /*************************************************************************/
57
58 /**
59   * This method returns the number of columns in the result set.
60   *
61   * @return The number of columns in the result set.
62   *
63   * @exception SQLException If an error occurs.
64   */
65 public abstract int
66 getColumnCount() throws SQLException;
67
68 /*************************************************************************/
69
70 /**
71   * This method test whether or not the column is an auto-increment column.
72   * Auto-increment columns are read-only.
73   *
74   * @param index The index of the column to test.
75   *
76   * @return <code>true</code> if the column is auto-increment, <code>false</code>
77   * otherwise.
78   *
79   * @exception SQLException If an error occurs.
80   */
81 public abstract boolean
82 isAutoIncrement(int index) throws SQLException;
83
84 /*************************************************************************/
85
86 /**
87   * This method tests whether or not a column is case sensitive in its values.
88   *
89   * @param index The index of the column to test.
90   *
91   * @return <code>true</code> if the column value is case sensitive,
92   * <code>false</code> otherwise.
93   *
94   * @exception SQLException If an error occurs.
95   */
96 public abstract boolean
97 isCaseSensitive(int index) throws SQLException;
98
99 /*************************************************************************/
100
101 /**
102   * This method tests whether not the specified column can be used in 
103   * a WHERE clause.
104   *
105   * @param index The index of the column to test.
106   *
107   * @return <code>true</code> if the column may be used in a WHERE clause,
108   * <code>false</code> otherwise.
109   *
110   * @exception SQLException If an error occurs.
111   */
112 public abstract boolean
113 isSearchable(int index) throws SQLException;
114
115 /*************************************************************************/
116
117 /**
118   * This method tests whether or not the column stores a monetary value.
119   *
120   * @param index The index of the column to test.
121   *
122   * @return <code>true</code> if the column contains a monetary value,
123   * <code>false</code> otherwise.
124   *
125   * @exception SQLException If an error occurs.
126   */
127 public abstract boolean
128 isCurrency(int index) throws SQLException;
129
130 /*************************************************************************/
131
132 /**
133   * This method returns a value indicating whether or not the specified
134   * column may contain a NULL value.
135   *
136   * @param index The index of the column to test.
137   *
138   * @return A constant indicating whether or not the column can contain NULL,
139   * which will be one of <code>columnNoNulls</code>,
140   * <code>columnNullable</code>, or <code>columnNullableUnknown</code>.
141   *
142   * @exception SQLException If an error occurs.
143   */
144 public abstract int
145 isNullable(int index) throws SQLException;
146
147 /*************************************************************************/
148
149 /**
150   * This method tests whether or not the value of the specified column
151   * is signed or unsigned.
152   *
153   * @param index The index of the column to test.
154   *
155   * @return <code>true</code> if the column value is signed, <code>false</code>
156   * otherwise.
157   *
158   * @exception SQLException If an error occurs.
159   */
160 public abstract boolean
161 isSigned(int index) throws SQLException;
162
163 /*************************************************************************/
164
165 /**
166   * This method returns the maximum number of characters that can be used
167   * to display a value in this column.
168   *
169   * @param index The index of the column to check.
170   *
171   * @return The maximum number of characters that can be used to display a
172   * value for this column.
173   *
174   * @exception SQLException If an error occurs.
175   */
176 public abstract int
177 getColumnDisplaySize(int index) throws SQLException;
178
179 /*************************************************************************/
180
181 /**
182   * This method returns a string that should be used as a caption for this
183   * column for user display purposes.
184   *
185   * @param index The index of the column to check.
186   *
187   * @return A display string for the column.
188   *
189   * @exception SQLException If an error occurs.
190   */
191 public abstract String
192 getColumnLabel(int index) throws SQLException;
193
194 /*************************************************************************/
195
196 /**
197   * This method returns the name of the specified column.
198   *
199   * @param index The index of the column to return the name of.
200   *
201   * @return The name of the column.
202   *
203   * @exception SQLException If an error occurs.
204   */
205 public abstract String
206 getColumnName(int index) throws SQLException;
207
208 /*************************************************************************/
209
210 /**
211   * This method returns the name of the schema that contains the specified
212   * column.
213   *
214   * @param index The index of the column to check the schema name for.
215   *
216   * @return The name of the schema that contains the column.
217   *
218   * @exception SQLException If an error occurs.
219   */
220 public abstract String
221 getSchemaName(int index) throws SQLException;
222
223 /*************************************************************************/
224
225 /**
226   * This method returns the precision of the specified column, which is the
227   * number of decimal digits it contains.
228   *
229   * @param index The index of the column to check the precision on.
230   *
231   * @return The precision of the specified column.
232   *
233   * @exception SQLException If an error occurs.
234   */
235 public abstract int
236 getPrecision(int index) throws SQLException;
237
238 /*************************************************************************/
239
240 /**
241   * This method returns the scale of the specified column, which is the
242   * number of digits to the right of the decimal point.
243   *
244   * @param index The index column to check the scale of.
245   *
246   * @return The scale of the column.
247   *
248   * @exception SQLException If an error occurs.
249   */
250 public abstract int
251 getScale(int index) throws SQLException;
252
253 /*************************************************************************/
254
255 /**
256   * This method returns the name of the table containing the specified
257   * column.
258   *
259   * @param index The index of the column to check the table name for.
260   *
261   * @return The name of the table containing the column.
262   *
263   * @exception SQLException If an error occurs.
264   */
265 public abstract String
266 getTableName(int index) throws SQLException;
267
268 /*************************************************************************/
269
270 /**
271   * This method returns the name of the catalog containing the specified
272   * column.
273   *
274   * @param index The index of the column to check the catalog name for.
275   *
276   * @return The name of the catalog containing the column.
277   *
278   * @exception SQLException If an error occurs.
279   */
280 public abstract String
281 getCatalogName(int index) throws SQLException;
282
283 /*************************************************************************/
284
285 /**
286   * This method returns the SQL type of the specified column.  This will
287   * be one of the constants from <code>Types</code>.
288   *
289   * @param index The index of the column to check the SQL type of.
290   *
291   * @return The SQL type for this column.
292   *
293   * @exception SQLException If an error occurs.
294   *
295   * @see Types
296   */
297 public abstract int
298 getColumnType(int index) throws SQLException;
299
300 /*************************************************************************/
301
302 /**
303   * This method returns the name of the SQL type for this column.
304   *
305   * @param index The index of the column to check the SQL type name for.
306   *
307   * @return The name of the SQL type for this column.
308   *
309   * @exception SQLException If an error occurs.
310   */
311 public abstract String
312 getColumnTypeName(int index) throws SQLException;
313
314 /*************************************************************************/
315
316 /**
317   * This method tests whether or not the specified column is read only.
318   *
319   * @param index The index of the column to check.
320   *
321   * @return <code>true</code> if the column is read only, <code>false</code>
322   * otherwise.
323   *
324   * @exception SQLException If an error occurs.
325   */
326 public abstract boolean
327 isReadOnly(int index) throws SQLException;
328
329 /*************************************************************************/
330
331 /**
332   * This method tests whether or not the column may be writable.  This
333   * does not guarantee that a write will be successful.
334   *
335   * @param index The index of the column to check for writability.
336   *
337   * @return <code>true</code> if the column may be writable,
338   * <code>false</code> otherwise.
339   *
340   * @exception SQLException If an error occurs.
341   */
342 public abstract boolean
343 isWritable(int index) throws SQLException;
344
345 /*************************************************************************/
346
347 /**
348   * This method tests whether or not the column is writable.  This
349   * does guarantee that a write will be successful.
350   *
351   * @param index The index of the column to check for writability.
352   *
353   * @return <code>true</code> if the column is writable,
354   * <code>false</code> otherwise.
355   *
356   * @exception SQLException If an error occurs.
357   */
358 public abstract boolean
359 isDefinitelyWritable(int index) throws SQLException;
360
361 /*************************************************************************/
362
363 /**
364   * This method returns the name of the Java class which will be used to
365   * create objects representing the data in this column.
366   *
367   * @param index The index of the column to check.
368   *
369   * @return The name of the Java class that will be used for values in
370   * this column.
371   *
372   * @exception SQLException If an error occurs.
373   */
374 public abstract String
375 getColumnClassName(int index) throws SQLException;
376
377 } // interface ResultSetMetaData
378