KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > rmijdbc > RJResultSetMetaData


1
2 /**
3  * RmiJdbc client/server JDBC Driver
4  * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997
5  *
6  * @version 1.0
7  * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com)
8  */

9
10 package org.objectweb.rmijdbc;
11
12 import java.sql.*;
13 import java.rmi.RemoteException JavaDoc;
14
15 /**
16  * A ResultSetMetaData object can be used to find out about the types
17  * and properties of the columns in a ResultSet.
18  */

19
20 public class RJResultSetMetaData
21 implements java.sql.ResultSetMetaData JavaDoc, java.io.Serializable JavaDoc {
22
23   RJResultSetMetaDataInterface rmiMetaData_;
24
25   public RJResultSetMetaData(RJResultSetMetaDataInterface r) {
26     rmiMetaData_ = r;
27   }
28
29   /**
30    * What's the number of columns in the ResultSet?
31    *
32    * @return the number
33    */

34   public int getColumnCount() throws SQLException {
35     try {
36       return rmiMetaData_.getColumnCount();
37     } catch(RemoteException JavaDoc e) {
38       throw new java.sql.SQLException JavaDoc(e.getMessage());
39     }
40   }
41
42   /**
43    * Is the column automatically numbered, thus read-only?
44    *
45    * @param column the first column is 1, the second is 2, ...
46    * @return true if so
47    */

48   public boolean isAutoIncrement(int column) throws SQLException {
49     try {
50       return rmiMetaData_.isAutoIncrement(column);
51     } catch(RemoteException JavaDoc e) {
52       throw new java.sql.SQLException JavaDoc(e.getMessage());
53     }
54   }
55
56   /**
57    * Does a column's case matter?
58    *
59    * @param column the first column is 1, the second is 2, ...
60    * @return true if so
61    */

62   public boolean isCaseSensitive(int column) throws SQLException {
63     try {
64       return rmiMetaData_.isCaseSensitive(column);
65     } catch(RemoteException JavaDoc e) {
66       throw new java.sql.SQLException JavaDoc(e.getMessage());
67     }
68   }
69
70   /**
71    * Can the column be used in a where clause?
72    *
73    * @param column the first column is 1, the second is 2, ...
74    * @return true if so
75    */

76   public boolean isSearchable(int column) throws SQLException {
77     try {
78       return rmiMetaData_.isSearchable(column);
79     } catch(RemoteException JavaDoc e) {
80       throw new java.sql.SQLException JavaDoc(e.getMessage());
81     }
82   }
83
84   /**
85    * Is the column a cash value?
86    *
87    * @param column the first column is 1, the second is 2, ...
88    * @return true if so
89    */

90   public boolean isCurrency(int column) throws SQLException {
91     try {
92       return rmiMetaData_.isCurrency(column);
93     } catch(RemoteException JavaDoc e) {
94       throw new java.sql.SQLException JavaDoc(e.getMessage());
95     }
96   }
97
98   /**
99    * Can you put a NULL in this column?
100    *
101    * @param column the first column is 1, the second is 2, ...
102    * @return columnNoNulls, columnNullable or columnNullableUnknown
103    */

104   public int isNullable(int column) throws SQLException {
105     try {
106       return rmiMetaData_.isNullable(column);
107     } catch(RemoteException JavaDoc e) {
108       throw new java.sql.SQLException JavaDoc(e.getMessage());
109     }
110   }
111
112   /**
113    * Is the column a signed number?
114    *
115    * @param column the first column is 1, the second is 2, ...
116    * @return true if so
117    */

118   public boolean isSigned(int column) throws SQLException {
119     try {
120       return rmiMetaData_.isSigned(column);
121     } catch(RemoteException JavaDoc e) {
122       throw new java.sql.SQLException JavaDoc(e.getMessage());
123     }
124   }
125
126   /**
127    * What's the column's normal max width in chars?
128    *
129    * @param column the first column is 1, the second is 2, ...
130    * @return max width
131    */

132   public int getColumnDisplaySize(int column) throws SQLException {
133     try {
134       return rmiMetaData_.getColumnDisplaySize(column);
135     } catch(RemoteException JavaDoc e) {
136       throw new java.sql.SQLException JavaDoc(e.getMessage());
137     }
138   }
139
140   /**
141    * What's the suggested column title for use in printouts and
142    * displays?
143    *
144    * @param column the first column is 1, the second is 2, ...
145    * @return true if so
146    */

147   public String JavaDoc getColumnLabel(int column) throws SQLException {
148     try {
149       return rmiMetaData_.getColumnLabel(column);
150     } catch(RemoteException JavaDoc e) {
151       throw new java.sql.SQLException JavaDoc(e.getMessage());
152     }
153   }
154
155   /**
156    * What's a column's name?
157    *
158    * @param column the first column is 1, the second is 2, ...
159    * @return column name
160    */

161   public String JavaDoc getColumnName(int column) throws SQLException {
162     try {
163       return rmiMetaData_.getColumnName(column);
164     } catch(RemoteException JavaDoc e) {
165       throw new java.sql.SQLException JavaDoc(e.getMessage());
166     }
167   }
168
169   /**
170    * What's a column's table's schema?
171    *
172    * @param column the first column is 1, the second is 2, ...
173    * @return schema name or "" if not applicable
174    */

175   public String JavaDoc getSchemaName(int column) throws SQLException {
176     try {
177       return rmiMetaData_.getSchemaName(column);
178     } catch(RemoteException JavaDoc e) {
179       throw new java.sql.SQLException JavaDoc(e.getMessage());
180     }
181   }
182
183   /**
184    * What's a column's number of decimal digits?
185    *
186    * @param column the first column is 1, the second is 2, ...
187    * @return precision
188    */

189   public int getPrecision(int column) throws SQLException {
190     try {
191       return rmiMetaData_.getPrecision(column);
192     } catch(RemoteException JavaDoc e) {
193       throw new java.sql.SQLException JavaDoc(e.getMessage());
194     }
195   }
196
197   /**
198    * What's a column's number of digits to right of the decimal point?
199    *
200    * @param column the first column is 1, the second is 2, ...
201    * @return scale
202    */

203   public int getScale(int column) throws SQLException {
204     try {
205       return rmiMetaData_.getScale(column);
206     } catch(RemoteException JavaDoc e) {
207       throw new java.sql.SQLException JavaDoc(e.getMessage());
208     }
209   }
210
211   /**
212    * What's a column's table name?
213    *
214    * @return table name or "" if not applicable
215    */

216   public String JavaDoc getTableName(int column) throws SQLException {
217     try {
218       return rmiMetaData_.getTableName(column);
219     } catch(RemoteException JavaDoc e) {
220       throw new java.sql.SQLException JavaDoc(e.getMessage());
221     }
222   }
223
224   /**
225    * What's a column's table's catalog name?
226    *
227    * @param column the first column is 1, the second is 2, ...
228    * @return column name or "" if not applicable.
229    */

230   public String JavaDoc getCatalogName(int column) throws SQLException {
231     try {
232       return rmiMetaData_.getCatalogName(column);
233     } catch(RemoteException JavaDoc e) {
234       throw new java.sql.SQLException JavaDoc(e.getMessage());
235     }
236   }
237
238   /**
239    * What's a column's SQL type?
240    *
241    * @param column the first column is 1, the second is 2, ...
242    * @return SQL type
243    * @see Types
244    */

245   public int getColumnType(int column) throws SQLException {
246     try {
247       return rmiMetaData_.getColumnType(column);
248     } catch(RemoteException JavaDoc e) {
249       throw new java.sql.SQLException JavaDoc(e.getMessage());
250     }
251   }
252
253   /**
254    * What's a column's data source specific type name?
255    *
256    * @param column the first column is 1, the second is 2, ...
257    * @return type name
258    */

259   public String JavaDoc getColumnTypeName(int column) throws SQLException {
260     try {
261       return rmiMetaData_.getColumnTypeName(column);
262     } catch(RemoteException JavaDoc e) {
263       throw new java.sql.SQLException JavaDoc(e.getMessage());
264     }
265   }
266
267   /**
268    * Is a column definitely not writable?
269    *
270    * @param column the first column is 1, the second is 2, ...
271    * @return true if so
272    */

273   public boolean isReadOnly(int column) throws SQLException {
274     try {
275       return rmiMetaData_.isReadOnly(column);
276     } catch(RemoteException JavaDoc e) {
277       throw new java.sql.SQLException JavaDoc(e.getMessage());
278     }
279   }
280
281   /**
282    * Is it possible for a write on the column to succeed?
283    *
284    * @param column the first column is 1, the second is 2, ...
285    * @return true if so
286    */

287   public boolean isWritable(int column) throws SQLException {
288     try {
289       return rmiMetaData_.isWritable(column);
290     } catch(RemoteException JavaDoc e) {
291       throw new java.sql.SQLException JavaDoc(e.getMessage());
292     }
293   }
294
295   /**
296    * Will a write on the column definitely succeed?
297    *
298    * @param column the first column is 1, the second is 2, ...
299    * @return true if so
300    */

301   public boolean isDefinitelyWritable(int column) throws SQLException {
302     try {
303       return rmiMetaData_.isDefinitelyWritable(column);
304     } catch(RemoteException JavaDoc e) {
305       throw new java.sql.SQLException JavaDoc(e.getMessage());
306     }
307   }
308
309 // JDBC 2.0 methods
310

311 public String JavaDoc getColumnClassName(int column) throws SQLException
312   {
313     try {
314       return rmiMetaData_.getColumnClassName(column);
315     } catch(RemoteException JavaDoc e) {
316       throw new java.sql.SQLException JavaDoc(e.getMessage());
317     }
318   }
319
320 };
321
322
Popular Tags