KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Additional SSL Support
9  * Douglas Hammond(djhammond@sympatico.ca)
10  */

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

22
23 public class RJResultSetMetaDataServer
24 extends java.rmi.server.UnicastRemoteObject JavaDoc
25 implements RJResultSetMetaDataInterface, Unreferenced JavaDoc {
26
27   java.sql.ResultSetMetaData JavaDoc metadata_;
28
29   public RJResultSetMetaDataServer(java.sql.ResultSetMetaData JavaDoc md)
30   throws RemoteException {
31        super(RJJdbcServer.rmiJdbcListenerPort, RJJdbcServer.rmiClientSocketFactory, RJJdbcServer.rmiServerSocketFactory);
32     metadata_ = md;
33   }
34
35   public void unreferenced() { Runtime.getRuntime().gc(); }
36
37   /**
38    * What's the number of columns in the ResultSet?
39    *
40    * @return the number
41    */

42   public int getColumnCount() throws RemoteException, SQLException JavaDoc {
43     return metadata_.getColumnCount();
44   }
45
46   /**
47    * Is the column automatically numbered, thus read-only?
48    *
49    * @param column the first column is 1, the second is 2, ...
50    * @return true if so
51    */

52   public boolean isAutoIncrement(int column)
53   throws RemoteException, SQLException JavaDoc {
54     return metadata_.isAutoIncrement(column);
55   }
56
57   /**
58    * Does a column's case matter?
59    *
60    * @param column the first column is 1, the second is 2, ...
61    * @return true if so
62    */

63   public boolean isCaseSensitive(int column)
64   throws RemoteException, SQLException JavaDoc {
65     return metadata_.isCaseSensitive(column);
66   }
67
68   /**
69    * Can the column be used in a where clause?
70    *
71    * @param column the first column is 1, the second is 2, ...
72    * @return true if so
73    */

74   public boolean isSearchable(int column) throws RemoteException, SQLException JavaDoc {
75     return metadata_.isSearchable(column);
76   }
77
78   /**
79    * Is the column a cash value?
80    *
81    * @param column the first column is 1, the second is 2, ...
82    * @return true if so
83    */

84   public boolean isCurrency(int column) throws RemoteException, SQLException JavaDoc {
85     return metadata_.isCurrency(column);
86   }
87
88   /**
89    * Can you put a NULL in this column?
90    *
91    * @param column the first column is 1, the second is 2, ...
92    * @return columnNoNulls, columnNullable or columnNullableUnknown
93    */

94   public int isNullable(int column) throws RemoteException, SQLException JavaDoc {
95     return metadata_.isNullable(column);
96   }
97
98   /**
99    * Is the column a signed number?
100    *
101    * @param column the first column is 1, the second is 2, ...
102    * @return true if so
103    */

104   public boolean isSigned(int column) throws RemoteException, SQLException JavaDoc {
105     return metadata_.isSigned(column);
106   }
107
108   /**
109    * What's the column's normal max width in chars?
110    *
111    * @param column the first column is 1, the second is 2, ...
112    * @return max width
113    */

114   public int getColumnDisplaySize(int column)
115   throws RemoteException, SQLException JavaDoc {
116     return metadata_.getColumnDisplaySize(column);
117   }
118
119   /**
120    * What's the suggested column title for use in printouts and
121    * displays?
122    *
123    * @param column the first column is 1, the second is 2, ...
124    * @return true if so
125    */

126   public String JavaDoc getColumnLabel(int column)
127   throws RemoteException, SQLException JavaDoc {
128     return metadata_.getColumnLabel(column);
129   }
130
131   /**
132    * What's a column's name?
133    *
134    * @param column the first column is 1, the second is 2, ...
135    * @return column name
136    */

137   public String JavaDoc getColumnName(int column) throws RemoteException, SQLException JavaDoc {
138     return metadata_.getColumnName(column);
139   }
140
141   /**
142    * What's a column's table's schema?
143    *
144    * @param column the first column is 1, the second is 2, ...
145    * @return schema name or "" if not applicable
146    */

147   public String JavaDoc getSchemaName(int column) throws RemoteException, SQLException JavaDoc {
148     return metadata_.getSchemaName(column);
149   }
150
151   /**
152    * What's a column's number of decimal digits?
153    *
154    * @param column the first column is 1, the second is 2, ...
155    * @return precision
156    */

157   public int getPrecision(int column) throws RemoteException, SQLException JavaDoc {
158     return metadata_.getPrecision(column);
159   }
160
161   /**
162    * What's a column's number of digits to right of the decimal point?
163    *
164    * @param column the first column is 1, the second is 2, ...
165    * @return scale
166    */

167   public int getScale(int column) throws RemoteException, SQLException JavaDoc {
168     return metadata_.getScale(column);
169   }
170
171   /**
172    * What's a column's table name?
173    *
174    * @return table name or "" if not applicable
175    */

176   public String JavaDoc getTableName(int column) throws RemoteException, SQLException JavaDoc {
177     return metadata_.getTableName(column);
178   }
179
180   /**
181    * What's a column's table's catalog name?
182    *
183    * @param column the first column is 1, the second is 2, ...
184    * @return column name or "" if not applicable.
185    */

186   public String JavaDoc getCatalogName(int column)
187   throws RemoteException, SQLException JavaDoc {
188     return metadata_.getCatalogName(column);
189   }
190
191   /**
192    * What's a column's SQL type?
193    *
194    * @param column the first column is 1, the second is 2, ...
195    * @return SQL type
196    * @see Types
197    */

198   public int getColumnType(int column) throws RemoteException, SQLException JavaDoc {
199     return metadata_.getColumnType(column);
200   }
201
202   /**
203    * What's a column's data source specific type name?
204    *
205    * @param column the first column is 1, the second is 2, ...
206    * @return type name
207    */

208   public String JavaDoc getColumnTypeName(int column)
209   throws RemoteException, SQLException JavaDoc {
210     return metadata_.getColumnTypeName(column);
211   }
212
213   /**
214    * Is a column definitely not writable?
215    *
216    * @param column the first column is 1, the second is 2, ...
217    * @return true if so
218    */

219   public boolean isReadOnly(int column) throws RemoteException, SQLException JavaDoc {
220     return metadata_.isReadOnly(column);
221   }
222
223   /**
224    * Is it possible for a write on the column to succeed?
225    *
226    * @param column the first column is 1, the second is 2, ...
227    * @return true if so
228    */

229   public boolean isWritable(int column) throws RemoteException, SQLException JavaDoc {
230     return metadata_.isWritable(column);
231   }
232
233   /**
234    * Will a write on the column definitely succeed?
235    *
236    * @param column the first column is 1, the second is 2, ...
237    * @return true if so
238    */

239   public boolean isDefinitelyWritable(int column)
240   throws RemoteException, SQLException JavaDoc {
241     return metadata_.isDefinitelyWritable(column);
242   }
243 // JDBC 2.0 methods
244

245 public String JavaDoc getColumnClassName(int column) throws RemoteException, SQLException JavaDoc
246   {
247       return metadata_.getColumnClassName(column);
248   }
249
250 };
251
252
Popular Tags