KickJava   Java API By Example, From Geeks To Geeks.

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


1
2 /**
3  * RmiJdbc client/server JDBC Driver
4  * (C) ExperLog 1999-2000
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 import java.util.Map JavaDoc;
15
16 /**
17  * The mapping in the Java programming language for the SQL type ARRAY.
18  * By default, an Array is a transaction duration reference to an SQL array.
19  * By default, an Array is implemented using an SQL LOCATOR(array) internally.
20  */

21
22 public class RJArray implements java.sql.Array JavaDoc, java.io.Serializable JavaDoc
23 {
24
25   RJArrayInterface rmiArray_;
26
27   public RJArray(RJArrayInterface a) {
28     rmiArray_ = a;
29   }
30
31   /**
32    * Retrieves the contents of the SQL array designated by this Array object
33    * in the form of an array in the Java programming language.
34    */

35   public Object JavaDoc getArray() throws SQLException {
36     try {
37       return rmiArray_.getArray();
38     } catch(RemoteException JavaDoc e) {
39       throw new java.sql.SQLException JavaDoc(e.getMessage());
40     }
41   }
42
43   /**
44    * Returns an array containing a slice of the SQL array, beginning with the
45    * specified index and containing up to count successive elements of the
46    * SQL array.
47    */

48   public Object JavaDoc getArray(long index, int count) throws SQLException {
49     try {
50       return rmiArray_.getArray(index, count);
51     } catch(RemoteException JavaDoc e) {
52       throw new java.sql.SQLException JavaDoc(e.getMessage());
53     }
54   }
55
56   /**
57    * Returns an array containing a slice of the SQL array object designated by
58    * this object, beginning with the specified index and containing up to
59    * count successive elements of the SQL array.
60    */

61   public Object JavaDoc getArray(long index, int count, Map JavaDoc map) throws SQLException {
62     try {
63       return rmiArray_.getArray(index, count, map);
64     } catch(RemoteException JavaDoc e) {
65       throw new java.sql.SQLException JavaDoc(e.getMessage());
66     }
67   }
68
69   /**
70    * Retrieves the contents of the SQL array designated by this Array object,
71    * using the specified map for type map customizations.
72    */

73   public Object JavaDoc getArray(Map JavaDoc map) throws SQLException {
74     try {
75       return rmiArray_.getArray(map);
76     } catch(RemoteException JavaDoc e) {
77       throw new java.sql.SQLException JavaDoc(e.getMessage());
78     }
79   }
80
81   /**
82    * Returns the JDBC type of the elements in the array designated by this
83    * Array object.
84    */

85   public int getBaseType() throws SQLException {
86     try {
87       return rmiArray_.getBaseType();
88     } catch(RemoteException JavaDoc e) {
89       throw new java.sql.SQLException JavaDoc(e.getMessage());
90     }
91   }
92
93   /**
94    * Returns the SQL type name of the elements in the array designated by this
95    * Array object.
96    */

97   public String JavaDoc getBaseTypeName() throws SQLException {
98     try {
99       return rmiArray_.getBaseTypeName();
100     } catch(RemoteException JavaDoc e) {
101       throw new java.sql.SQLException JavaDoc(e.getMessage());
102     }
103   }
104
105   /**
106    * Returns a result set that contains the elements of the array
107    * designated by this Array object.
108    */

109   public java.sql.ResultSet JavaDoc getResultSet()
110   throws SQLException {
111     try {
112       return new RJResultSet(rmiArray_.getResultSet(), null);
113     } catch(RemoteException JavaDoc e) {
114       throw new java.sql.SQLException JavaDoc(e.getMessage());
115     }
116   }
117
118   /**
119    * Returns a result set holding the elements of the subarray that starts
120    * at index index and contains up to count successive elements.
121    */

122   public java.sql.ResultSet JavaDoc getResultSet(long index, int count)
123   throws SQLException {
124     try {
125       return new RJResultSet(rmiArray_.getResultSet(index, count), null);
126     } catch(RemoteException JavaDoc e) {
127       throw new java.sql.SQLException JavaDoc(e.getMessage());
128     }
129   }
130
131   /**
132    * Returns a result set holding the elements of the subarray that starts
133    * at index index and contains up to count successive elements.
134    */

135   public java.sql.ResultSet JavaDoc getResultSet(long index, int count, Map JavaDoc map)
136   throws SQLException {
137     try {
138       return new RJResultSet(rmiArray_.getResultSet(index, count, map), null);
139     } catch(RemoteException JavaDoc e) {
140       throw new java.sql.SQLException JavaDoc(e.getMessage());
141     }
142   }
143
144   /**
145    * Returns a result set that contains the elements of the array designated
146    * by this Array object and uses the given map to map the array elements.
147    */

148   public java.sql.ResultSet JavaDoc getResultSet(Map JavaDoc map) throws SQLException {
149     try {
150       return new RJResultSet(rmiArray_.getResultSet(map), null);
151     } catch(RemoteException JavaDoc e) {
152       throw new java.sql.SQLException JavaDoc(e.getMessage());
153     }
154   }
155
156 };
157
158
Popular Tags