1 |
/* ResultSetMetaData.java -- Returns information about the ResultSet |
/* ResultSetMetaData.java -- Returns information about the ResultSet |
2 |
Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
39 |
package java.sql; |
package java.sql; |
40 |
|
|
41 |
/** |
/** |
42 |
* This interface provides a mechanism for obtaining information about |
* This interface provides a mechanism for obtaining information about |
43 |
* the columns that are present in a <code>ResultSet</code>. |
* the columns that are present in a <code>ResultSet</code>. |
44 |
* <p> |
* <p> |
45 |
* Note that in this class column indexes start at 1, not 0. |
* Note that in this class column indexes start at 1, not 0. |
46 |
* |
* |
47 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* @author Aaron M. Renn (arenn@urbanophile.com) |
48 |
*/ |
*/ |
49 |
public interface ResultSetMetaData |
public interface ResultSetMetaData |
50 |
{ |
{ |
51 |
|
/** |
52 |
/** |
* The column does not allow NULL's. |
53 |
* The column does not allow NULL's. |
*/ |
54 |
*/ |
public static final int columnNoNulls = 0; |
55 |
public static final int columnNoNulls = 0; |
|
56 |
|
/** |
57 |
/** |
* The column allows NULL's. |
58 |
* The column allows NULL's. |
*/ |
59 |
*/ |
public static final int columnNullable = 1; |
60 |
public static final int columnNullable = 1; |
|
61 |
|
/** |
62 |
/** |
* It is unknown whether or not the column allows NULL's. |
63 |
* It is unknown whether or not the column allows NULL's. |
*/ |
64 |
*/ |
public static final int columnNullableUnknown = 2; |
65 |
public static final int columnNullableUnknown = 2; |
|
66 |
|
/** |
67 |
/*************************************************************************/ |
* This method returns the number of columns in the result set. |
68 |
|
* |
69 |
/** |
* @return The number of columns in the result set. |
70 |
* This method returns the number of columns in the result set. |
* @exception SQLException If an error occurs. |
71 |
* |
*/ |
72 |
* @return The number of columns in the result set. |
public int getColumnCount() throws SQLException; |
73 |
* |
|
74 |
* @exception SQLException If an error occurs. |
/** |
75 |
*/ |
* This method test whether or not the column is an auto-increment column. |
76 |
public abstract int |
* Auto-increment columns are read-only. |
77 |
getColumnCount() throws SQLException; |
* |
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. |
82 |
* This method test whether or not the column is an auto-increment column. |
*/ |
83 |
* Auto-increment columns are read-only. |
public boolean isAutoIncrement(int column) throws SQLException; |
84 |
* |
|
85 |
* @param index The index of the column to test. |
/** |
86 |
* |
* This method tests whether or not a column is case sensitive in its values. |
87 |
* @return <code>true</code> if the column is auto-increment, <code>false</code> |
* |
88 |
* otherwise. |
* @param index The index of the column to test. |
89 |
* |
* @return <code>true</code> if the column value is case sensitive, |
90 |
* @exception SQLException If an error occurs. |
* <code>false</code> otherwise. |
91 |
*/ |
* @exception SQLException If an error occurs. |
92 |
public abstract boolean |
*/ |
93 |
isAutoIncrement(int index) throws SQLException; |
public boolean isCaseSensitive(int column) throws SQLException; |
94 |
|
|
95 |
/*************************************************************************/ |
/** |
96 |
|
* This method tests whether not the specified column can be used in |
97 |
/** |
* a WHERE clause. |
98 |
* This method tests whether or not a column is case sensitive in its values. |
* |
99 |
* |
* @param index The index of the column to test. |
100 |
* @param index The index of the column to test. |
* @return <code>true</code> if the column may be used in a WHERE clause, |
101 |
* |
* <code>false</code> otherwise. |
102 |
* @return <code>true</code> if the column value is case sensitive, |
* @exception SQLException If an error occurs. |
103 |
* <code>false</code> otherwise. |
*/ |
104 |
* |
public boolean isSearchable(int column) throws SQLException; |
105 |
* @exception SQLException If an error occurs. |
|
106 |
*/ |
/** |
107 |
public abstract boolean |
* This method tests whether or not the column stores a monetary value. |
108 |
isCaseSensitive(int index) throws SQLException; |
* |
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. |
113 |
* This method tests whether not the specified column can be used in |
*/ |
114 |
* a WHERE clause. |
public boolean isCurrency(int column) throws SQLException; |
115 |
* |
|
116 |
* @param index The index of the column to test. |
/** |
117 |
* |
* This method returns a value indicating whether or not the specified |
118 |
* @return <code>true</code> if the column may be used in a WHERE clause, |
* column may contain a NULL value. |
119 |
* <code>false</code> otherwise. |
* |
120 |
* |
* @param index The index of the column to test. |
121 |
* @exception SQLException If an error occurs. |
* @return A constant indicating whether or not the column can contain NULL, |
122 |
*/ |
* which will be one of <code>columnNoNulls</code>, |
123 |
public abstract boolean |
* <code>columnNullable</code>, or <code>columnNullableUnknown</code>. |
124 |
isSearchable(int index) throws SQLException; |
* @exception SQLException If an error occurs. |
125 |
|
*/ |
126 |
/*************************************************************************/ |
public int isNullable(int column) throws SQLException; |
127 |
|
|
128 |
/** |
/** |
129 |
* This method tests whether or not the column stores a monetary value. |
* This method tests whether or not the value of the specified column |
130 |
* |
* is signed or unsigned. |
131 |
* @param index The index of the column to test. |
* |
132 |
* |
* @param index The index of the column to test. |
133 |
* @return <code>true</code> if the column contains a monetary value, |
* @return <code>true</code> if the column value is signed, <code>false</code> |
134 |
* <code>false</code> otherwise. |
* otherwise. |
135 |
* |
* @exception SQLException If an error occurs. |
136 |
* @exception SQLException If an error occurs. |
*/ |
137 |
*/ |
public boolean isSigned(int column) throws SQLException; |
138 |
public abstract boolean |
|
139 |
isCurrency(int index) throws SQLException; |
/** |
140 |
|
* This method returns the maximum number of characters that can be used |
141 |
/*************************************************************************/ |
* to display a value in this column. |
142 |
|
* |
143 |
/** |
* @param index The index of the column to check. |
144 |
* This method returns a value indicating whether or not the specified |
* @return The maximum number of characters that can be used to display a |
145 |
* column may contain a NULL value. |
* value for this column. |
146 |
* |
* @exception SQLException If an error occurs. |
147 |
* @param index The index of the column to test. |
*/ |
148 |
* |
public int getColumnDisplaySize(int column) throws SQLException; |
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>. |
* This method returns a string that should be used as a caption for this |
152 |
* |
* column for user display purposes. |
153 |
* @exception SQLException If an error occurs. |
* |
154 |
*/ |
* @param index The index of the column to check. |
155 |
public abstract int |
* @return A display string for the column. |
156 |
isNullable(int index) throws SQLException; |
* @exception SQLException If an error occurs. |
157 |
|
*/ |
158 |
/*************************************************************************/ |
public String getColumnLabel(int column) throws SQLException; |
159 |
|
|
160 |
/** |
/** |
161 |
* This method tests whether or not the value of the specified column |
* This method returns the name of the specified column. |
162 |
* is signed or unsigned. |
* |
163 |
* |
* @param index The index of the column to return the name of. |
164 |
* @param index The index of the column to test. |
* @return The name of the column. |
165 |
* |
* @exception SQLException If an error occurs. |
166 |
* @return <code>true</code> if the column value is signed, <code>false</code> |
*/ |
167 |
* otherwise. |
public String getColumnName(int column) throws SQLException; |
168 |
* |
|
169 |
* @exception SQLException If an error occurs. |
/** |
170 |
*/ |
* This method returns the name of the schema that contains the specified |
171 |
public abstract boolean |
* column. |
172 |
isSigned(int index) throws SQLException; |
* |
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. |
176 |
/** |
*/ |
177 |
* This method returns the maximum number of characters that can be used |
public String getSchemaName(int column) throws SQLException; |
178 |
* to display a value in this column. |
|
179 |
* |
/** |
180 |
* @param index The index of the column to check. |
* This method returns the precision of the specified column, which is the |
181 |
* |
* number of decimal digits it contains. |
182 |
* @return The maximum number of characters that can be used to display a |
* |
183 |
* value for this column. |
* @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. |
* @exception SQLException If an error occurs. |
186 |
*/ |
*/ |
187 |
public abstract int |
public int getPrecision(int column) throws SQLException; |
188 |
getColumnDisplaySize(int index) throws SQLException; |
|
189 |
|
/** |
190 |
/*************************************************************************/ |
* This method returns the scale of the specified column, which is the |
191 |
|
* number of digits to the right of the decimal point. |
192 |
/** |
* |
193 |
* This method returns a string that should be used as a caption for this |
* @param index The index column to check the scale of. |
194 |
* column for user display purposes. |
* @return The scale of the column. |
195 |
* |
* @exception SQLException If an error occurs. |
196 |
* @param index The index of the column to check. |
*/ |
197 |
* |
public int getScale(int column) throws SQLException; |
198 |
* @return A display string for the column. |
|
199 |
* |
/** |
200 |
* @exception SQLException If an error occurs. |
* This method returns the name of the table containing the specified |
201 |
*/ |
* column. |
202 |
public abstract String |
* |
203 |
getColumnLabel(int index) throws SQLException; |
* @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. |
206 |
|
*/ |
207 |
/** |
public String getTableName(int column) throws SQLException; |
208 |
* This method returns the name of the specified column. |
|
209 |
* |
/** |
210 |
* @param index The index of the column to return the name of. |
* This method returns the name of the catalog containing the specified |
211 |
* |
* column. |
212 |
* @return The name of the column. |
* |
213 |
* |
* @param index The index of the column to check the catalog name for. |
214 |
* @exception SQLException If an error occurs. |
* @return The name of the catalog containing the column. |
215 |
*/ |
* @exception SQLException If an error occurs. |
216 |
public abstract String |
*/ |
217 |
getColumnName(int index) throws SQLException; |
public String getCatalogName(int column) throws SQLException; |
218 |
|
|
219 |
/*************************************************************************/ |
/** |
220 |
|
* This method returns the SQL type of the specified column. This will |
221 |
/** |
* be one of the constants from <code>Types</code>. |
222 |
* This method returns the name of the schema that contains the specified |
* |
223 |
* column. |
* @param index The index of the column to check the SQL type of. |
224 |
* |
* @return The SQL type for this column. |
225 |
* @param index The index of the column to check the schema name for. |
* @exception SQLException If an error occurs. |
226 |
* |
* @see Types |
227 |
* @return The name of the schema that contains the column. |
*/ |
228 |
* |
public int getColumnType(int column) throws SQLException; |
229 |
* @exception SQLException If an error occurs. |
|
230 |
*/ |
/** |
231 |
public abstract String |
* This method returns the name of the SQL type for this column. |
232 |
getSchemaName(int index) throws SQLException; |
* |
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. |
236 |
/** |
*/ |
237 |
* This method returns the precision of the specified column, which is the |
public String getColumnTypeName(int column) throws SQLException; |
238 |
* number of decimal digits it contains. |
|
239 |
* |
/** |
240 |
* @param index The index of the column to check the precision on. |
* This method tests whether or not the specified column is read only. |
241 |
* |
* |
242 |
* @return The precision of the specified column. |
* @param index The index of the column to check. |
243 |
* |
* @return <code>true</code> if the column is read only, <code>false</code> |
244 |
* @exception SQLException If an error occurs. |
* otherwise. |
245 |
*/ |
* @exception SQLException If an error occurs. |
246 |
public abstract int |
*/ |
247 |
getPrecision(int index) throws SQLException; |
public boolean isReadOnly(int column) throws SQLException; |
248 |
|
|
249 |
/*************************************************************************/ |
/** |
250 |
|
* This method tests whether or not the column may be writable. This |
251 |
/** |
* does not guarantee that a write will be successful. |
252 |
* This method returns the scale of the specified column, which is the |
* |
253 |
* number of digits to the right of the decimal point. |
* @param index The index of the column to check for writability. |
254 |
* |
* @return <code>true</code> if the column may be writable, |
255 |
* @param index The index column to check the scale of. |
* <code>false</code> otherwise. |
256 |
* |
* @exception SQLException If an error occurs. |
257 |
* @return The scale of the column. |
*/ |
258 |
* |
public boolean isWritable(int column) throws SQLException; |
259 |
* @exception SQLException If an error occurs. |
|
260 |
*/ |
/** |
261 |
public abstract int |
* This method tests whether or not the column is writable. This |
262 |
getScale(int index) throws SQLException; |
* does guarantee that a write will be successful. |
263 |
|
* |
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 |
* This method returns the name of the table containing the specified |
* @exception SQLException If an error occurs. |
268 |
* column. |
*/ |
269 |
* |
public boolean isDefinitelyWritable(int column) throws SQLException; |
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. |
* This method returns the name of the Java class which will be used to |
273 |
* |
* create objects representing the data in this column. |
274 |
* @exception SQLException If an error occurs. |
* |
275 |
*/ |
* @param index The index of the column to check. |
276 |
public abstract String |
* @return The name of the Java class that will be used for values in |
277 |
getTableName(int index) throws SQLException; |
* this column. |
278 |
|
* @exception SQLException If an error occurs. |
279 |
/*************************************************************************/ |
*/ |
280 |
|
public String getColumnClassName(int column) throws SQLException; |
281 |
/** |
} |
|
* This method returns the name of the catalog containing the specified |
|
|
* column. |
|
|
* |
|
|
* @param index The index of the column to check the catalog name for. |
|
|
* |
|
|
* @return The name of the catalog containing the column. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract String |
|
|
getCatalogName(int index) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns the SQL type of the specified column. This will |
|
|
* be one of the constants from <code>Types</code>. |
|
|
* |
|
|
* @param index The index of the column to check the SQL type of. |
|
|
* |
|
|
* @return The SQL type for this column. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
* |
|
|
* @see Types |
|
|
*/ |
|
|
public abstract int |
|
|
getColumnType(int index) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns the name of the SQL type for this column. |
|
|
* |
|
|
* @param index The index of the column to check the SQL type name for. |
|
|
* |
|
|
* @return The name of the SQL type for this column. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract String |
|
|
getColumnTypeName(int index) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method tests whether or not the specified column is read only. |
|
|
* |
|
|
* @param index The index of the column to check. |
|
|
* |
|
|
* @return <code>true</code> if the column is read only, <code>false</code> |
|
|
* otherwise. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract boolean |
|
|
isReadOnly(int index) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method tests whether or not the column may be writable. This |
|
|
* does not guarantee that a write will be successful. |
|
|
* |
|
|
* @param index The index of the column to check for writability. |
|
|
* |
|
|
* @return <code>true</code> if the column may be writable, |
|
|
* <code>false</code> otherwise. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract boolean |
|
|
isWritable(int index) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method tests whether or not the column is writable. This |
|
|
* does guarantee that a write will be successful. |
|
|
* |
|
|
* @param index The index of the column to check for writability. |
|
|
* |
|
|
* @return <code>true</code> if the column is writable, |
|
|
* <code>false</code> otherwise. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract boolean |
|
|
isDefinitelyWritable(int index) throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method returns the name of the Java class which will be used to |
|
|
* create objects representing the data in this column. |
|
|
* |
|
|
* @param index The index of the column to check. |
|
|
* |
|
|
* @return The name of the Java class that will be used for values in |
|
|
* this column. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract String |
|
|
getColumnClassName(int index) throws SQLException; |
|
|
|
|
|
} // interface ResultSetMetaData |
|
|
|
|