| 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 | 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.
|
|---|
| 25 |
|
|---|
| 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. */
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | package 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 | */
|
|---|
| 49 | public interface ResultSetMetaData
|
|---|
| 50 | {
|
|---|
| 51 |
|
|---|
| 52 | /**
|
|---|
| 53 | * The column does not allow NULL's.
|
|---|
| 54 | */
|
|---|
| 55 | public static final int columnNoNulls = 0;
|
|---|
| 56 |
|
|---|
| 57 | /**
|
|---|
| 58 | * The column allows NULL's.
|
|---|
| 59 | */
|
|---|
| 60 | public static final int columnNullable = 1;
|
|---|
| 61 |
|
|---|
| 62 | /**
|
|---|
| 63 | * It is unknown whether or not the column allows NULL's.
|
|---|
| 64 | */
|
|---|
| 65 | public 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 | */
|
|---|
| 76 | public abstract int
|
|---|
| 77 | getColumnCount() 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 | */
|
|---|
| 92 | public abstract boolean
|
|---|
| 93 | isAutoIncrement(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 | */
|
|---|
| 107 | public abstract boolean
|
|---|
| 108 | isCaseSensitive(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 | */
|
|---|
| 123 | public abstract boolean
|
|---|
| 124 | isSearchable(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 | */
|
|---|
| 138 | public abstract boolean
|
|---|
| 139 | isCurrency(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 | */
|
|---|
| 155 | public abstract int
|
|---|
| 156 | isNullable(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 | */
|
|---|
| 171 | public abstract boolean
|
|---|
| 172 | isSigned(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 | */
|
|---|
| 187 | public abstract int
|
|---|
| 188 | getColumnDisplaySize(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 | */
|
|---|
| 202 | public abstract String
|
|---|
| 203 | getColumnLabel(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 | */
|
|---|
| 216 | public abstract String
|
|---|
| 217 | getColumnName(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 | */
|
|---|
| 231 | public abstract String
|
|---|
| 232 | getSchemaName(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 | */
|
|---|
| 246 | public abstract int
|
|---|
| 247 | getPrecision(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 | */
|
|---|
| 261 | public abstract int
|
|---|
| 262 | getScale(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 | */
|
|---|
| 276 | public abstract String
|
|---|
| 277 | getTableName(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 | */
|
|---|
| 291 | public abstract String
|
|---|
| 292 | getCatalogName(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 | */
|
|---|
| 308 | public abstract int
|
|---|
| 309 | getColumnType(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 | */
|
|---|
| 322 | public abstract String
|
|---|
| 323 | getColumnTypeName(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 | */
|
|---|
| 337 | public abstract boolean
|
|---|
| 338 | isReadOnly(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 | */
|
|---|
| 353 | public abstract boolean
|
|---|
| 354 | isWritable(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 | */
|
|---|
| 369 | public abstract boolean
|
|---|
| 370 | isDefinitelyWritable(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 | */
|
|---|
| 385 | public abstract String
|
|---|
| 386 | getColumnClassName(int index) throws SQLException;
|
|---|
| 387 |
|
|---|
| 388 | } // interface ResultSetMetaData
|
|---|
| 389 |
|
|---|