KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > vti > VTIMetaDataTemplate


1 /*
2
3    Derby - Class org.apache.derby.vti.VTIMetaDataTemplate
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.vti;
23
24 import java.sql.SQLException JavaDoc;
25 import java.sql.ResultSetMetaData JavaDoc;
26
27 /**
28     An abstract implementation of ResultSetMetaData (JDBC 1.2) that is useful
29     when writing a VTI (virtual table interface).
30     
31     This class implements
32     most of the methods of ResultSetMetaData, each one throwing a SQLException
33     with the name of the method. A concrete subclass can then just implement
34     the methods not implemented here and override any methods it needs
35     to implement for correct functionality.
36     <P>
37     The methods not implemented here are
38     <UL>
39     <LI>getColumnCount()
40     <LI>getColumnType()
41     </UL>
42     <BR>
43     For virtual tables the database engine only calls methods defined
44     in the JDBC 1.2 definition of java.sql.ResultSetMetaData.
45     <BR>
46     Classes that implement a JDBC 2.0 conformant java.sql.ResultSetMetaData can be used
47     as the meta data for virtual tables.
48     <BR>
49     Developers can use the VTIMetaDataTemplate20 instead of this class when
50     developing in a Java 2 environment.
51  */

52
53 public abstract class VTIMetaDataTemplate implements ResultSetMetaData JavaDoc {
54
55     /**
56      * Is the column automatically numbered, and thus read-only?
57      *
58      * @param column the first column is 1, the second is 2, ...
59      * @return true if the column is automatically numbered
60      * @exception SQLException if a database-access error occurs.
61      */

62     public boolean isAutoIncrement(int column) throws SQLException JavaDoc {
63         throw new SQLException JavaDoc("isAutoIncrement");
64     }
65
66
67     /**
68      * Does a column's case matter?
69      *
70      * @param column the first column is 1, the second is 2, ...
71      * @return true if the column is case-sensitive
72      * @exception SQLException if a database-access error occurs.
73      */

74     public boolean isCaseSensitive(int column) throws SQLException JavaDoc {
75         throw new SQLException JavaDoc("isCaseSensitive");
76     }
77     
78
79     /**
80      * Can the column be used in a WHERE clause?
81      *
82      * @param column the first column is 1, the second is 2, ...
83      * @return true if the column is searchable
84      * @exception SQLException if a database-access error occurs.
85      */

86     public boolean isSearchable(int column) throws SQLException JavaDoc{
87         throw new SQLException JavaDoc("isSearchable");
88     }
89
90
91     /**
92      * Is the column a cash value?
93      *
94      * @param column the first column is 1, the second is 2, ...
95      * @return true if the column is a cash value
96      * @exception SQLException if a database-access error occurs.
97      */

98     public boolean isCurrency(int column) throws SQLException JavaDoc{
99         throw new SQLException JavaDoc("isCurrency");
100     }
101
102
103     /**
104      * Can you put a NULL in this column?
105      *
106      * @param column the first column is 1, the second is 2, ...
107      * @return columnNoNulls, columnNullable or columnNullableUnknown
108      * @exception SQLException if a database-access error occurs.
109      */

110     public int isNullable(int column) throws SQLException JavaDoc{
111         throw new SQLException JavaDoc("isNullable");
112     }
113
114
115     /**
116      * Is the column a signed number?
117      *
118      * @param column the first column is 1, the second is 2, ...
119      * @return true if the column is a signed number
120      * @exception SQLException if a database-access error occurs.
121      */

122     public boolean isSigned(int column) throws SQLException JavaDoc {
123         throw new SQLException JavaDoc("isSigned");
124     }
125
126
127     /**
128      * What's the column's normal maximum width in chars?
129      *
130      * @param column the first column is 1, the second is 2, ...
131      * @return the column's maximum width
132      * @exception SQLException if a database-access error occurs.
133      */

134     public int getColumnDisplaySize(int column) throws SQLException JavaDoc {
135         throw new SQLException JavaDoc("getColumnDisplaySize");
136     }
137
138
139     /**
140      * What's the suggested column title for use in printouts and
141      * displays?
142      *
143      * @param column the first column is 1, the second is 2, ...
144      * @return the column's title
145      * @exception SQLException if a database-access error occurs.
146      */

147     public String JavaDoc getColumnLabel(int column) throws SQLException JavaDoc {
148         throw new SQLException JavaDoc("getColumnLabel");
149     }
150     
151
152     /**
153      * What's a column's name?
154      *
155      * @param column the first column is 1, the second is 2, ...
156      * @return column name
157      * @exception SQLException if a database-access error occurs.
158      */

159     public String JavaDoc getColumnName(int column) throws SQLException JavaDoc {
160         throw new SQLException JavaDoc("getColumnName");
161     }
162
163
164     /**
165      * What's a column's table's schema?
166      *
167      * @param column the first column is 1, the second is 2, ...
168      * @return schema name or "" if not applicable
169      * @exception SQLException if a database-access error occurs.
170      */

171     public String JavaDoc getSchemaName(int column) throws SQLException JavaDoc {
172         throw new SQLException JavaDoc("getSchemaName");
173     }
174
175
176     /**
177      * How many decimal digits are in the column?
178      *
179      * @param column the first column is 1, the second is 2, ...
180      * @return the column's precision
181      * @exception SQLException if a database-access error occurs.
182      */

183     public int getPrecision(int column) throws SQLException JavaDoc {
184         throw new SQLException JavaDoc("getPrecision");
185     }
186
187
188     /**
189      * What's a column's number of digits to the right of the decimal point?
190      *
191      * @param column the first column is 1, the second is 2, ...
192      * @return the column's scale
193      * @exception SQLException if a database-access error occurs.
194      */

195     public int getScale(int column) throws SQLException JavaDoc {
196         throw new SQLException JavaDoc("getScale");
197     }
198     
199
200     /**
201      * What's a column's table name?
202      *
203      * @param column the first column is 1, the second is 2, ...
204      * @return the column's table name or "" if not applicable
205      * @exception SQLException if a database-access error occurs.
206      */

207     public String JavaDoc getTableName(int column) throws SQLException JavaDoc {
208         throw new SQLException JavaDoc("getTableName");
209     }
210
211
212     /**
213      * What's a column's table's catalog name?
214      *
215      * @param column the first column is 1, the second is 2, ...
216      * @return the column's table's catalog name or "" if not applicable.
217      * @exception SQLException if a database-access error occurs.
218      */

219     public String JavaDoc getCatalogName(int column) throws SQLException JavaDoc {
220         throw new SQLException JavaDoc("getCatalogName");
221     }
222
223
224     /**
225      * What's a column's data source specific type name?
226      *
227      * @param column the first column is 1, the second is 2, ...
228      * @return the column's type name
229      * @exception SQLException if a database-access error occurs.
230      */

231     public String JavaDoc getColumnTypeName(int column) throws SQLException JavaDoc {
232         throw new SQLException JavaDoc("getColumnTypeName");
233     }
234
235
236     /**
237      * Is a column definitely not writable?
238      *
239      * @param column the first column is 1, the second is 2, ...
240      * @return true - vti's are read only
241      * false - column is not read-only
242      * @exception SQLException if a database-access error occurs.
243      */

244     public boolean isReadOnly(int column) throws SQLException JavaDoc {
245         return true;
246     }
247
248
249     /**
250      * Is it possible for a write on the column to succeed?
251      *
252      * @param column the first column is 1, the second is 2, ...
253      * @return true if column is possibly writable
254      * @exception SQLException if a database-access error occurs.
255      */

256     public boolean isWritable(int column) throws SQLException JavaDoc {
257         return false;
258     }
259
260     /**
261      * Will a write on the column definitely succeed?
262      *
263      * @param column the first column is 1, the second is 2, ...
264      * @return true if column is definitely writable
265      * @exception SQLException if a database-access error occurs.
266      */

267     public boolean isDefinitelyWritable(int column) throws SQLException JavaDoc {
268         return false;
269     }
270
271     /*
272     ** JDBC 2.0
273     */

274
275     /**
276      * Returns the fully-qualified name of the Java class whose instances
277      * are manufactured if the method <code>ResultSet.<!-- -->getObject</code>
278      * is called to retrieve a value from the column. JDBC 2.0.
279      *
280      * @exception SQLException if a database-access error occurs
281      */

282     public String JavaDoc getColumnClassName(int column) throws SQLException JavaDoc {
283         throw new SQLException JavaDoc("getColumnClassName");
284     }
285 }
286
Popular Tags