001: /*
002:
003: Derby - Class org.apache.derby.vti.VTIMetaDataTemplate
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to You under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.vti;
023:
024: import java.sql.SQLException;
025: import java.sql.ResultSetMetaData;
026:
027: /**
028: An abstract implementation of ResultSetMetaData (JDBC 1.2) that is useful
029: when writing a VTI (virtual table interface).
030:
031: This class implements
032: most of the methods of ResultSetMetaData, each one throwing a SQLException
033: with the name of the method. A concrete subclass can then just implement
034: the methods not implemented here and override any methods it needs
035: to implement for correct functionality.
036: <P>
037: The methods not implemented here are
038: <UL>
039: <LI>getColumnCount()
040: <LI>getColumnType()
041: </UL>
042: <BR>
043: For virtual tables the database engine only calls methods defined
044: in the JDBC 1.2 definition of java.sql.ResultSetMetaData.
045: <BR>
046: Classes that implement a JDBC 2.0 conformant java.sql.ResultSetMetaData can be used
047: as the meta data for virtual tables.
048: <BR>
049: Developers can use the VTIMetaDataTemplate20 instead of this class when
050: developing in a Java 2 environment.
051: */
052:
053: public abstract class VTIMetaDataTemplate implements ResultSetMetaData {
054:
055: /**
056: * Is the column automatically numbered, and thus read-only?
057: *
058: * @param column the first column is 1, the second is 2, ...
059: * @return true if the column is automatically numbered
060: * @exception SQLException if a database-access error occurs.
061: */
062: public boolean isAutoIncrement(int column) throws SQLException {
063: throw new SQLException("isAutoIncrement");
064: }
065:
066: /**
067: * Does a column's case matter?
068: *
069: * @param column the first column is 1, the second is 2, ...
070: * @return true if the column is case-sensitive
071: * @exception SQLException if a database-access error occurs.
072: */
073: public boolean isCaseSensitive(int column) throws SQLException {
074: throw new SQLException("isCaseSensitive");
075: }
076:
077: /**
078: * Can the column be used in a WHERE clause?
079: *
080: * @param column the first column is 1, the second is 2, ...
081: * @return true if the column is searchable
082: * @exception SQLException if a database-access error occurs.
083: */
084: public boolean isSearchable(int column) throws SQLException {
085: throw new SQLException("isSearchable");
086: }
087:
088: /**
089: * Is the column a cash value?
090: *
091: * @param column the first column is 1, the second is 2, ...
092: * @return true if the column is a cash value
093: * @exception SQLException if a database-access error occurs.
094: */
095: public boolean isCurrency(int column) throws SQLException {
096: throw new SQLException("isCurrency");
097: }
098:
099: /**
100: * Can you put a NULL in this column?
101: *
102: * @param column the first column is 1, the second is 2, ...
103: * @return columnNoNulls, columnNullable or columnNullableUnknown
104: * @exception SQLException if a database-access error occurs.
105: */
106: public int isNullable(int column) throws SQLException {
107: throw new SQLException("isNullable");
108: }
109:
110: /**
111: * Is the column a signed number?
112: *
113: * @param column the first column is 1, the second is 2, ...
114: * @return true if the column is a signed number
115: * @exception SQLException if a database-access error occurs.
116: */
117: public boolean isSigned(int column) throws SQLException {
118: throw new SQLException("isSigned");
119: }
120:
121: /**
122: * What's the column's normal maximum width in chars?
123: *
124: * @param column the first column is 1, the second is 2, ...
125: * @return the column's maximum width
126: * @exception SQLException if a database-access error occurs.
127: */
128: public int getColumnDisplaySize(int column) throws SQLException {
129: throw new SQLException("getColumnDisplaySize");
130: }
131:
132: /**
133: * What's the suggested column title for use in printouts and
134: * displays?
135: *
136: * @param column the first column is 1, the second is 2, ...
137: * @return the column's title
138: * @exception SQLException if a database-access error occurs.
139: */
140: public String getColumnLabel(int column) throws SQLException {
141: throw new SQLException("getColumnLabel");
142: }
143:
144: /**
145: * What's a column's name?
146: *
147: * @param column the first column is 1, the second is 2, ...
148: * @return column name
149: * @exception SQLException if a database-access error occurs.
150: */
151: public String getColumnName(int column) throws SQLException {
152: throw new SQLException("getColumnName");
153: }
154:
155: /**
156: * What's a column's table's schema?
157: *
158: * @param column the first column is 1, the second is 2, ...
159: * @return schema name or "" if not applicable
160: * @exception SQLException if a database-access error occurs.
161: */
162: public String getSchemaName(int column) throws SQLException {
163: throw new SQLException("getSchemaName");
164: }
165:
166: /**
167: * How many decimal digits are in the column?
168: *
169: * @param column the first column is 1, the second is 2, ...
170: * @return the column's precision
171: * @exception SQLException if a database-access error occurs.
172: */
173: public int getPrecision(int column) throws SQLException {
174: throw new SQLException("getPrecision");
175: }
176:
177: /**
178: * What's a column's number of digits to the right of the decimal point?
179: *
180: * @param column the first column is 1, the second is 2, ...
181: * @return the column's scale
182: * @exception SQLException if a database-access error occurs.
183: */
184: public int getScale(int column) throws SQLException {
185: throw new SQLException("getScale");
186: }
187:
188: /**
189: * What's a column's table name?
190: *
191: * @param column the first column is 1, the second is 2, ...
192: * @return the column's table name or "" if not applicable
193: * @exception SQLException if a database-access error occurs.
194: */
195: public String getTableName(int column) throws SQLException {
196: throw new SQLException("getTableName");
197: }
198:
199: /**
200: * What's a column's table's catalog name?
201: *
202: * @param column the first column is 1, the second is 2, ...
203: * @return the column's table's catalog name or "" if not applicable.
204: * @exception SQLException if a database-access error occurs.
205: */
206: public String getCatalogName(int column) throws SQLException {
207: throw new SQLException("getCatalogName");
208: }
209:
210: /**
211: * What's a column's data source specific type name?
212: *
213: * @param column the first column is 1, the second is 2, ...
214: * @return the column's type name
215: * @exception SQLException if a database-access error occurs.
216: */
217: public String getColumnTypeName(int column) throws SQLException {
218: throw new SQLException("getColumnTypeName");
219: }
220:
221: /**
222: * Is a column definitely not writable?
223: *
224: * @param column the first column is 1, the second is 2, ...
225: * @return true - vti's are read only
226: * false - column is not read-only
227: * @exception SQLException if a database-access error occurs.
228: */
229: public boolean isReadOnly(int column) throws SQLException {
230: return true;
231: }
232:
233: /**
234: * Is it possible for a write on the column to succeed?
235: *
236: * @param column the first column is 1, the second is 2, ...
237: * @return true if column is possibly writable
238: * @exception SQLException if a database-access error occurs.
239: */
240: public boolean isWritable(int column) throws SQLException {
241: return false;
242: }
243:
244: /**
245: * Will a write on the column definitely succeed?
246: *
247: * @param column the first column is 1, the second is 2, ...
248: * @return true if column is definitely writable
249: * @exception SQLException if a database-access error occurs.
250: */
251: public boolean isDefinitelyWritable(int column) throws SQLException {
252: return false;
253: }
254:
255: /*
256: ** JDBC 2.0
257: */
258:
259: /**
260: * Returns the fully-qualified name of the Java class whose instances
261: * are manufactured if the method <code>ResultSet.<!-- -->getObject</code>
262: * is called to retrieve a value from the column. JDBC 2.0.
263: *
264: * @exception SQLException if a database-access error occurs
265: */
266: public String getColumnClassName(int column) throws SQLException {
267: throw new SQLException("getColumnClassName");
268: }
269: }
|