1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 /*
23  * To change this template, choose Tools | Templates
24  * and open the template in the editor.
25  */
26 
27 package org.openoffice.complex.forms.tools;
28 
29 import com.sun.star.container.XNameAccess;
30 import com.sun.star.io.XInputStream;
31 import com.sun.star.sdbc.SQLException;
32 import com.sun.star.sdbc.XArray;
33 import com.sun.star.sdbc.XBlob;
34 import com.sun.star.sdbc.XClob;
35 import com.sun.star.sdbc.XRef;
36 import com.sun.star.sdbc.XResultSet;
37 import com.sun.star.sdbc.XRow;
38 import com.sun.star.uno.UnoRuntime;
39 import com.sun.star.util.Date;
40 import com.sun.star.util.DateTime;
41 import com.sun.star.util.Time;
42 
43 /**
44  *
45  * @author frank.schoenheit@sun.com
46  */
47 public class ResultSet implements XResultSet, XRow
48 {
49     private final XResultSet    m_resultSet;
50     private final XRow          m_row;
51 
ResultSet( final Object _resultSet )52     public ResultSet( final Object _resultSet )
53     {
54         m_resultSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, _resultSet );
55         m_row = (XRow)UnoRuntime.queryInterface( XRow.class, _resultSet );
56     }
57 
58     public
next()59     boolean next() throws SQLException
60     {
61         return m_resultSet.next();
62     }
63 
64     public
isBeforeFirst()65     boolean isBeforeFirst() throws SQLException
66     {
67         return m_resultSet.isBeforeFirst();
68     }
69 
70     public
isAfterLast()71     boolean isAfterLast() throws SQLException
72     {
73         return m_resultSet.isAfterLast();
74     }
75 
76     public
isFirst()77     boolean isFirst() throws SQLException
78     {
79         return m_resultSet.isFirst();
80     }
81 
82     public
isLast()83     boolean isLast() throws SQLException
84     {
85         return m_resultSet.isLast();
86     }
87 
88     public
beforeFirst()89     void beforeFirst() throws SQLException
90     {
91         m_resultSet.beforeFirst();
92     }
93 
94     public
afterLast()95     void afterLast() throws SQLException
96     {
97         m_resultSet.afterLast();
98     }
99 
100     public
first()101     boolean first() throws SQLException
102     {
103         return m_resultSet.first();
104     }
105 
106     public
last()107     boolean last() throws SQLException
108     {
109         return m_resultSet.last();
110     }
111 
112     public
getRow()113     int getRow() throws SQLException
114     {
115         return m_resultSet.getRow();
116     }
117 
118     public
absolute( int _row )119     boolean absolute( int _row ) throws SQLException
120     {
121         return m_resultSet.absolute( _row );
122     }
123 
124     public
relative( int _offset )125     boolean relative( int _offset ) throws SQLException
126     {
127         return m_resultSet.relative( _offset );
128     }
129 
130     public
previous()131     boolean previous() throws SQLException
132     {
133         return m_resultSet.previous();
134     }
135 
136     public
refreshRow()137     void refreshRow() throws SQLException
138     {
139         m_resultSet.refreshRow();
140     }
141 
142     public
rowUpdated()143     boolean rowUpdated() throws SQLException
144     {
145         return m_resultSet.rowUpdated();
146     }
147 
148     public
rowInserted()149     boolean rowInserted() throws SQLException
150     {
151         return m_resultSet.rowInserted();
152     }
153 
154     public
rowDeleted()155     boolean rowDeleted() throws SQLException
156     {
157         return m_resultSet.rowDeleted();
158     }
159 
160     public
getStatement()161     Object getStatement() throws SQLException
162     {
163         return m_resultSet.getStatement();
164     }
165 
166     public
wasNull()167     boolean wasNull() throws SQLException
168     {
169         return m_row.wasNull();
170     }
171 
172     public
getString( int _colIndex )173     String getString( int _colIndex ) throws SQLException
174     {
175         return m_row.getString( _colIndex );
176     }
177 
178     public
getBoolean( int _colIndex )179     boolean getBoolean( int _colIndex ) throws SQLException
180     {
181         return m_row.getBoolean( _colIndex );
182     }
183 
184     public
getByte( int _colIndex )185     byte getByte( int _colIndex ) throws SQLException
186     {
187         return m_row.getByte( _colIndex );
188     }
189 
190     public
getShort( int _colIndex )191     short getShort( int _colIndex ) throws SQLException
192     {
193         return m_row.getShort( _colIndex );
194     }
195 
196     public
getInt( int _colIndex )197     int getInt( int _colIndex ) throws SQLException
198     {
199         return m_row.getInt( _colIndex );
200     }
201 
202     public
getLong( int _colIndex )203     long getLong( int _colIndex ) throws SQLException
204     {
205         return m_row.getLong( _colIndex );
206     }
207 
208     public
getFloat( int _colIndex )209     float getFloat( int _colIndex ) throws SQLException
210     {
211         return m_row.getFloat( _colIndex );
212     }
213 
214     public
getDouble( int _colIndex )215     double getDouble( int _colIndex ) throws SQLException
216     {
217         return m_row.getDouble( _colIndex );
218     }
219 
220     public
getBytes( int _colIndex )221     byte[] getBytes( int _colIndex ) throws SQLException
222     {
223         return m_row.getBytes( _colIndex );
224     }
225 
226     public
getDate( int _colIndex )227     Date getDate( int _colIndex ) throws SQLException
228     {
229         return m_row.getDate( _colIndex );
230     }
231 
232     public
getTime( int _colIndex )233     Time getTime( int _colIndex ) throws SQLException
234     {
235         return m_row.getTime( _colIndex );
236     }
237 
238     public
getTimestamp( int _colIndex )239     DateTime getTimestamp( int _colIndex ) throws SQLException
240     {
241         return m_row.getTimestamp( _colIndex );
242     }
243 
244     public
getBinaryStream( int _colIndex )245     XInputStream getBinaryStream( int _colIndex ) throws SQLException
246     {
247         return m_row.getBinaryStream( _colIndex );
248     }
249 
250     public
getCharacterStream( int _colIndex )251     XInputStream getCharacterStream( int _colIndex ) throws SQLException
252     {
253         return m_row.getCharacterStream( _colIndex );
254     }
255 
256     public
getObject( int _colIndex, XNameAccess _typeMap )257     Object getObject( int _colIndex, XNameAccess _typeMap ) throws SQLException
258     {
259         return m_row.getObject( _colIndex, _typeMap );
260     }
261 
262     public
getRef( int _colIndex )263     XRef getRef( int _colIndex ) throws SQLException
264     {
265         return m_row.getRef( _colIndex );
266     }
267 
268     public
getBlob( int _colIndex )269     XBlob getBlob( int _colIndex ) throws SQLException
270     {
271         return m_row.getBlob( _colIndex );
272     }
273 
274     public
getClob( int _colIndex )275     XClob getClob( int _colIndex ) throws SQLException
276     {
277         return m_row.getClob( _colIndex );
278     }
279 
280     public
getArray( int _colIndex )281     XArray getArray( int _colIndex ) throws SQLException
282     {
283         return m_row.getArray( _colIndex );
284     }
285 }
286