001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package java.sql;
019:
020: /**
021: * Provides information about the columns in a ResultSet.
022: */
023: public interface ResultSetMetaData {
024:
025: /**
026: * Indicates that a column cannot contain NULL values
027: */
028: public static final int columnNoNulls = 0;
029:
030: /**
031: * Indicates that a column can contain NULL values
032: */
033: public static final int columnNullable = 1;
034:
035: /**
036: * Indicates that it is unknown whether a column can contain NULLs or not
037: */
038: public static final int columnNullableUnknown = 2;
039:
040: /**
041: * Returns the title of indexed columns catalog
042: *
043: * @param column
044: * the column index, starting at 1
045: * @return the catalog title
046: * @throws SQLException
047: * if there is a database error
048: */
049: public String getCatalogName(int column) throws SQLException;
050:
051: /**
052: * Returns the fully-qualified type of the class that is produced when
053: * invoking ResultSet.getObject to recover this columns value.
054: *
055: * @param column
056: * the column index, starting at 1
057: * @return the fully-qualified class name
058: * @throws SQLException
059: * if there is a database error
060: */
061: public String getColumnClassName(int column) throws SQLException;
062:
063: /**
064: * Returns a count of the columns in this set of results.
065: *
066: * @return the column count
067: * @throws SQLException
068: * if there is a database error
069: */
070: public int getColumnCount() throws SQLException;
071:
072: /**
073: * Returns the indexed column's standard maximum width, expressed in number
074: * of characters.
075: *
076: * @param column
077: * the column index, starting at 1
078: * @return the column's max width
079: * @throws SQLException
080: * if there is a database error
081: */
082: public int getColumnDisplaySize(int column) throws SQLException;
083:
084: /**
085: * Returns a recommended title for the indexed column, to be used when the
086: * title needs to be displayed.
087: *
088: * @param column
089: * the column index, starting at 1
090: * @return the column's title
091: * @throws SQLException
092: * if there is a database error
093: */
094: public String getColumnLabel(int column) throws SQLException;
095:
096: /**
097: * Returns the title of the indexed column
098: *
099: * @param column
100: * the column index, starting at 1
101: * @return the column title
102: * @throws SQLException
103: * if there is a database error
104: */
105: public String getColumnName(int column) throws SQLException;
106:
107: /**
108: * Returns the type of the indexed column
109: *
110: * @param column
111: * the column index, starting at 1
112: * @return the column type
113: * @throws SQLException
114: * if there is a database error
115: */
116: public int getColumnType(int column) throws SQLException;
117:
118: /**
119: * Returns the type name of the indexed column
120: *
121: * @param column
122: * the column index, starting at 1
123: * @return the type name
124: * @throws SQLException
125: * if there is a database error
126: */
127: public String getColumnTypeName(int column) throws SQLException;
128:
129: /**
130: * Returns the decimal precision of the indexed column
131: *
132: * @param column
133: * the column index, starting at 1
134: * @return the precision
135: * @throws SQLException
136: * if there is a database error
137: */
138: public int getPrecision(int column) throws SQLException;
139:
140: /**
141: * Returns the number of decimal places in the indexed column.
142: *
143: * @param column
144: * the column index, starting at 1
145: * @return number of decimal places
146: * @throws SQLException
147: * if there is a database error
148: */
149: public int getScale(int column) throws SQLException;
150:
151: /**
152: * Returns the name of the indexed columns schema
153: *
154: * @param column
155: * the column index, starting at 1
156: * @return the name of the columns schema
157: * @throws SQLException
158: * if there is a database error
159: */
160: public String getSchemaName(int column) throws SQLException;
161:
162: /**
163: * Returns the title of the indexed columns table.
164: *
165: * @param column
166: * the column index, starting at 1
167: * @return the table title
168: * @throws SQLException
169: * if there is a database error
170: */
171: public String getTableName(int column) throws SQLException;
172:
173: /**
174: * Returns and indication of whether the indexed column has automatic
175: * numbering and is therefore read-only
176: *
177: * @param column
178: * the column index, starting at 1
179: * @return true if it is automatically numbered, false otherwise
180: * @throws SQLException
181: * if there is a database error
182: */
183: public boolean isAutoIncrement(int column) throws SQLException;
184:
185: /**
186: * Returns an indicator of whether the case of the indexed column is
187: * important
188: *
189: * @param column
190: * the column index, starting at 1
191: * @return true if case matters, false otherwise
192: * @throws SQLException
193: * if there is a database error
194: */
195: public boolean isCaseSensitive(int column) throws SQLException;
196:
197: /**
198: * Returns if the indexed column contains a monetary amount.
199: *
200: * @param column
201: * the column index, starting at 1
202: * @return true if it is a monetary value, false otherwise
203: * @throws SQLException
204: * if there is a database error
205: */
206: public boolean isCurrency(int column) throws SQLException;
207:
208: /**
209: * Returns an indication of whether writing to the indexed column is
210: * guaranteed to be successful
211: *
212: * @param column
213: * the column index, starting at 1
214: * @return true if the write is guaranteed, false otherwise
215: * @throws SQLException
216: * if there is a database error
217: */
218: public boolean isDefinitelyWritable(int column) throws SQLException;
219:
220: /**
221: * Returns whether the indexed column is nullable.
222: *
223: * @param column
224: * the column index, starting at 1
225: * @return true if it is nullable, false otherwise
226: * @throws SQLException
227: * if there is a database error
228: */
229: public int isNullable(int column) throws SQLException;
230:
231: /**
232: * Returns an indication of whether writing to the indexed column is
233: * guaranteed to be unsuccessful
234: *
235: * @param column
236: * the column index, starting at 1
237: * @return true if the column is read-only, false otherwise
238: * @throws SQLException
239: * if there is a database error
240: */
241: public boolean isReadOnly(int column) throws SQLException;
242:
243: /**
244: * Returns an indication of whether the indexed column is searchable.
245: *
246: * @param column
247: * the column index, starting at 1
248: * @return true if the indexed column is searchable, false otherwise.
249: * @throws SQLException
250: * if there is a database error
251: */
252: public boolean isSearchable(int column) throws SQLException;
253:
254: /**
255: * Returns an indicator of whether the values contained in the indexed
256: * column are signed.
257: *
258: * @param column
259: * the column index, starting at 1
260: * @return true if they are signed, false otherwise
261: * @throws SQLException
262: * if there is a database error
263: */
264: public boolean isSigned(int column) throws SQLException;
265:
266: /**
267: * Returns an indication of whether writing to the indexed column is
268: * possible.
269: *
270: * @param column
271: * the column index, starting at 1
272: * @return true if it is possible to write, false otherwise
273: * @throws SQLException
274: * if there is a database error
275: */
276: public boolean isWritable(int column) throws SQLException;
277: }
|