xref: /AOO41X/main/qadevOOo/tests/java/ifc/sdbc/_XRow.java (revision ef39d40d3f5e66cf3f035b3e93783012b340500d)
1*ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ef39d40dSAndrew Rist  * distributed with this work for additional information
6*ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9*ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15*ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18*ef39d40dSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*ef39d40dSAndrew Rist  *************************************************************/
21*ef39d40dSAndrew Rist 
22*ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package ifc.sdbc;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import java.util.Vector;
27cdf0e10cSrcweir 
28cdf0e10cSrcweir import lib.MultiMethodTest;
29cdf0e10cSrcweir 
30cdf0e10cSrcweir import com.sun.star.io.XDataInputStream;
31cdf0e10cSrcweir import com.sun.star.io.XInputStream;
32cdf0e10cSrcweir import com.sun.star.io.XTextInputStream;
33cdf0e10cSrcweir import com.sun.star.sdbc.SQLException;
34cdf0e10cSrcweir import com.sun.star.sdbc.XArray;
35cdf0e10cSrcweir import com.sun.star.sdbc.XBlob;
36cdf0e10cSrcweir import com.sun.star.sdbc.XClob;
37cdf0e10cSrcweir import com.sun.star.sdbc.XRef;
38cdf0e10cSrcweir import com.sun.star.sdbc.XRow;
39cdf0e10cSrcweir import com.sun.star.util.Date;
40cdf0e10cSrcweir import com.sun.star.util.DateTime;
41cdf0e10cSrcweir import com.sun.star.util.Time;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir /**
44cdf0e10cSrcweir * Testing <code>com.sun.star.sdbc.XRow</code>
45cdf0e10cSrcweir * interface methods :
46cdf0e10cSrcweir * <ul>
47cdf0e10cSrcweir *  <li><code> wasNull()</code></li>
48cdf0e10cSrcweir *  <li><code> getString()</code></li>
49cdf0e10cSrcweir *  <li><code> getBoolean()</code></li>
50cdf0e10cSrcweir *  <li><code> getByte()</code></li>
51cdf0e10cSrcweir *  <li><code> getShort()</code></li>
52cdf0e10cSrcweir *  <li><code> getInt()</code></li>
53cdf0e10cSrcweir *  <li><code> getLong()</code></li>
54cdf0e10cSrcweir *  <li><code> getFloat()</code></li>
55cdf0e10cSrcweir *  <li><code> getDouble()</code></li>
56cdf0e10cSrcweir *  <li><code> getBytes()</code></li>
57cdf0e10cSrcweir *  <li><code> getDate()</code></li>
58cdf0e10cSrcweir *  <li><code> getTime()</code></li>
59cdf0e10cSrcweir *  <li><code> getTimestamp()</code></li>
60cdf0e10cSrcweir *  <li><code> getBinaryStream()</code></li>
61cdf0e10cSrcweir *  <li><code> getCharacterStream()</code></li>
62cdf0e10cSrcweir *  <li><code> getObject()</code></li>
63cdf0e10cSrcweir *  <li><code> getRef()</code></li>
64cdf0e10cSrcweir *  <li><code> getBlob()</code></li>
65cdf0e10cSrcweir *  <li><code> getClob()</code></li>
66cdf0e10cSrcweir *  <li><code> getArray()</code></li>
67cdf0e10cSrcweir * </ul> <p>
68cdf0e10cSrcweir *
69cdf0e10cSrcweir * This interface is full tested in XRowUpdate interface test. Here
70cdf0e10cSrcweir * only exceptions checked.
71cdf0e10cSrcweir * <p>
72cdf0e10cSrcweir *
73cdf0e10cSrcweir * Object relations required :
74cdf0e10cSrcweir * <ul>
75cdf0e10cSrcweir * <li> <code>'CurrentRowData'</code> : (may be used in other
76cdf0e10cSrcweir * interface tests) is a <code>java.util.Vector</code> object
77cdf0e10cSrcweir * that contains column types and values in current row. Each
78cdf0e10cSrcweir * element of vector corresponds to appropriate column (element
79cdf0e10cSrcweir * with index 0 to column 1, 1 -> 2, etc.). <p>
80cdf0e10cSrcweir * The following <code>XRow</code> methods correspond to classes
81cdf0e10cSrcweir * in Vector :
82cdf0e10cSrcweir * <ul>
83cdf0e10cSrcweir *   <li> <code>getBinaryStream</code> -
84cdf0e10cSrcweir *        <code>com.sun.star.io.XDataInputStream</code> class. </li>
85cdf0e10cSrcweir *   <li> <code>getCharacterStream</code> -
86cdf0e10cSrcweir *        <code>com.sun.star.io.XTextInputStream</code> class. </li>
87cdf0e10cSrcweir *   <li> <code>getObject</code> -
88cdf0e10cSrcweir *        <code>java.lang.Object[]</code> class, the element with
89cdf0e10cSrcweir *         index 0 must be used. </li>
90cdf0e10cSrcweir * </ul>
91cdf0e10cSrcweir * Other methods uses types they return (i.e. <code>java.lang.String</code>
92cdf0e10cSrcweir * for <code>getString</code> method, <code>com.sun.star.sdbc.XRef</code>
93cdf0e10cSrcweir * for <code>getRef</code> method).
94cdf0e10cSrcweir * </li>
95cdf0e10cSrcweir * </ul>
96cdf0e10cSrcweir * @see com.sun.star.sdbc.XRaw
97cdf0e10cSrcweir * @see ifc.sdbc._XRowUpdate
98cdf0e10cSrcweir */
99cdf0e10cSrcweir public class _XRow extends MultiMethodTest {
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     // oObj filled by MultiMethodTest
102cdf0e10cSrcweir     public XRow oObj = null ;
103cdf0e10cSrcweir     private Vector data = null ;
104cdf0e10cSrcweir     private boolean notNullRes = true ;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     /**
107cdf0e10cSrcweir     * Retrieves object relation first.
108cdf0e10cSrcweir     */
before()109cdf0e10cSrcweir     public void before() {
110cdf0e10cSrcweir         data = (Vector) tEnv.getObjRelation("CurrentRowData") ;
111cdf0e10cSrcweir     }
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     /**
114cdf0e10cSrcweir     * Always has <b>OK</b> status.
115cdf0e10cSrcweir     */
_wasNull()116cdf0e10cSrcweir     public void _wasNull() {
117cdf0e10cSrcweir         executeMethod("getString()") ;
118cdf0e10cSrcweir         executeMethod("getBoolean()") ;
119cdf0e10cSrcweir         executeMethod("getByte()") ;
120cdf0e10cSrcweir         executeMethod("getShort()") ;
121cdf0e10cSrcweir         executeMethod("getInt()") ;
122cdf0e10cSrcweir         executeMethod("getLong()") ;
123cdf0e10cSrcweir         executeMethod("getFloat()") ;
124cdf0e10cSrcweir         executeMethod("getDouble()") ;
125cdf0e10cSrcweir         executeMethod("getBytes()") ;
126cdf0e10cSrcweir         executeMethod("getDate()") ;
127cdf0e10cSrcweir         executeMethod("getTime()") ;
128cdf0e10cSrcweir         executeMethod("getTimestamp()") ;
129cdf0e10cSrcweir         executeMethod("getBinaryStream()") ;
130cdf0e10cSrcweir         executeMethod("getCharacterStream()") ;
131cdf0e10cSrcweir         executeMethod("getObject()") ;
132cdf0e10cSrcweir         executeMethod("getRef()") ;
133cdf0e10cSrcweir         executeMethod("getBlob()") ;
134cdf0e10cSrcweir         executeMethod("getClob()") ;
135cdf0e10cSrcweir         executeMethod("getArray()") ;
136cdf0e10cSrcweir 
137cdf0e10cSrcweir         tRes.tested("wasNull()", notNullRes) ;
138cdf0e10cSrcweir     }
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     /**
141cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
142cdf0e10cSrcweir     */
_getString()143cdf0e10cSrcweir     public void _getString() {
144cdf0e10cSrcweir         boolean result = true ;
145cdf0e10cSrcweir         int col = findColumnOfType(String.class) ;
146cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
147cdf0e10cSrcweir         else {
148cdf0e10cSrcweir             try {
149cdf0e10cSrcweir                 String getStr = oObj.getString(col) ;
150cdf0e10cSrcweir                 //result &= ((String)data.get(col - 1)).equals(getStr) ;
151cdf0e10cSrcweir                 //notNullRes &= !oObj.wasNull() ;
152cdf0e10cSrcweir             } catch (SQLException e) {
153cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
154cdf0e10cSrcweir                 log.println(e) ;
155cdf0e10cSrcweir                 result = false ;
156cdf0e10cSrcweir             }
157cdf0e10cSrcweir         }
158cdf0e10cSrcweir 
159cdf0e10cSrcweir         tRes.tested("getString()", result) ;
160cdf0e10cSrcweir     }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     /**
163cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
164cdf0e10cSrcweir     */
_getBoolean()165cdf0e10cSrcweir     public void _getBoolean() {
166cdf0e10cSrcweir         boolean result = true ;
167cdf0e10cSrcweir         int col = findColumnOfType(Boolean.class) ;
168cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
169cdf0e10cSrcweir         else {
170cdf0e10cSrcweir             try {
171cdf0e10cSrcweir                 boolean getVal = oObj.getBoolean(col) ;
172cdf0e10cSrcweir                 //result &= ((Boolean)data.get(col - 1)).booleanValue() == getVal ;
173cdf0e10cSrcweir                 //notNullRes &= !oObj.wasNull() ;
174cdf0e10cSrcweir             } catch (SQLException e) {
175cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
176cdf0e10cSrcweir                 log.println(e) ;
177cdf0e10cSrcweir                 result = false ;
178cdf0e10cSrcweir             }
179cdf0e10cSrcweir         }
180cdf0e10cSrcweir 
181cdf0e10cSrcweir         tRes.tested("getBoolean()", result) ;
182cdf0e10cSrcweir     }
183cdf0e10cSrcweir 
184cdf0e10cSrcweir     /**
185cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
186cdf0e10cSrcweir     */
_getByte()187cdf0e10cSrcweir     public void _getByte() {
188cdf0e10cSrcweir         boolean result = true ;
189cdf0e10cSrcweir         int col = findColumnOfType(Byte.class) ;
190cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
191cdf0e10cSrcweir         else {
192cdf0e10cSrcweir             try {
193cdf0e10cSrcweir                 byte getVal = oObj.getByte(col) ;
194cdf0e10cSrcweir                 //result &= ((Byte)data.get(col - 1)).byteValue() == getVal ;
195cdf0e10cSrcweir                 //notNullRes &= !oObj.wasNull() ;
196cdf0e10cSrcweir             } catch (SQLException e) {
197cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
198cdf0e10cSrcweir                 log.println(e) ;
199cdf0e10cSrcweir                 result = false ;
200cdf0e10cSrcweir             }
201cdf0e10cSrcweir         }
202cdf0e10cSrcweir 
203cdf0e10cSrcweir         tRes.tested("getByte()", result) ;
204cdf0e10cSrcweir     }
205cdf0e10cSrcweir 
206cdf0e10cSrcweir     /**
207cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
208cdf0e10cSrcweir     */
_getShort()209cdf0e10cSrcweir     public void _getShort() {
210cdf0e10cSrcweir         boolean result = true ;
211cdf0e10cSrcweir         int col = findColumnOfType(Short.class) ;
212cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
213cdf0e10cSrcweir         else {
214cdf0e10cSrcweir             try {
215cdf0e10cSrcweir                 short getVal = oObj.getShort(col) ;
216cdf0e10cSrcweir                 //result &= ((Short)data.get(col - 1)).shortValue() == getVal ;
217cdf0e10cSrcweir                 //notNullRes &= !oObj.wasNull() ;
218cdf0e10cSrcweir             } catch (SQLException e) {
219cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
220cdf0e10cSrcweir                 log.println(e) ;
221cdf0e10cSrcweir                 result = false ;
222cdf0e10cSrcweir             }
223cdf0e10cSrcweir         }
224cdf0e10cSrcweir 
225cdf0e10cSrcweir         tRes.tested("getShort()", result) ;
226cdf0e10cSrcweir     }
227cdf0e10cSrcweir 
228cdf0e10cSrcweir     /**
229cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
230cdf0e10cSrcweir     */
_getInt()231cdf0e10cSrcweir     public void _getInt() {
232cdf0e10cSrcweir         boolean result = true ;
233cdf0e10cSrcweir         int col = findColumnOfType(Integer.class) ;
234cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
235cdf0e10cSrcweir         else {
236cdf0e10cSrcweir             try {
237cdf0e10cSrcweir                 int getVal = oObj.getInt(col) ;
238cdf0e10cSrcweir             } catch (SQLException e) {
239cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
240cdf0e10cSrcweir                 log.println(e) ;
241cdf0e10cSrcweir                 result = false ;
242cdf0e10cSrcweir             }
243cdf0e10cSrcweir         }
244cdf0e10cSrcweir 
245cdf0e10cSrcweir         tRes.tested("getInt()", result) ;
246cdf0e10cSrcweir     }
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     /**
249cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
250cdf0e10cSrcweir     */
_getLong()251cdf0e10cSrcweir     public void _getLong() {
252cdf0e10cSrcweir         boolean result = true ;
253cdf0e10cSrcweir         int col = findColumnOfType(Long.class) ;
254cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
255cdf0e10cSrcweir         else {
256cdf0e10cSrcweir             try {
257cdf0e10cSrcweir                 long getVal = oObj.getLong(col) ;
258cdf0e10cSrcweir             } catch (SQLException e) {
259cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
260cdf0e10cSrcweir                 log.println(e) ;
261cdf0e10cSrcweir                 result = false ;
262cdf0e10cSrcweir             }
263cdf0e10cSrcweir         }
264cdf0e10cSrcweir 
265cdf0e10cSrcweir         tRes.tested("getLong()", result) ;
266cdf0e10cSrcweir     }
267cdf0e10cSrcweir 
268cdf0e10cSrcweir     /**
269cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
270cdf0e10cSrcweir     */
_getFloat()271cdf0e10cSrcweir     public void _getFloat() {
272cdf0e10cSrcweir         boolean result = true ;
273cdf0e10cSrcweir         int col = findColumnOfType(Float.class) ;
274cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
275cdf0e10cSrcweir         else {
276cdf0e10cSrcweir             try {
277cdf0e10cSrcweir                 float getVal = oObj.getFloat(col) ;
278cdf0e10cSrcweir             } catch (SQLException e) {
279cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
280cdf0e10cSrcweir                 log.println(e) ;
281cdf0e10cSrcweir                 result = false ;
282cdf0e10cSrcweir             }
283cdf0e10cSrcweir         }
284cdf0e10cSrcweir 
285cdf0e10cSrcweir         tRes.tested("getFloat()", result) ;
286cdf0e10cSrcweir     }
287cdf0e10cSrcweir 
288cdf0e10cSrcweir     /**
289cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
290cdf0e10cSrcweir     */
_getDouble()291cdf0e10cSrcweir     public void _getDouble() {
292cdf0e10cSrcweir         boolean result = true ;
293cdf0e10cSrcweir         int col = findColumnOfType(Double.class) ;
294cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
295cdf0e10cSrcweir         else {
296cdf0e10cSrcweir             try {
297cdf0e10cSrcweir                 double getVal = oObj.getDouble(col) ;
298cdf0e10cSrcweir             } catch (SQLException e) {
299cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
300cdf0e10cSrcweir                 log.println(e) ;
301cdf0e10cSrcweir                 result = false ;
302cdf0e10cSrcweir             }
303cdf0e10cSrcweir         }
304cdf0e10cSrcweir 
305cdf0e10cSrcweir         tRes.tested("getDouble()", result) ;
306cdf0e10cSrcweir     }
307cdf0e10cSrcweir 
308cdf0e10cSrcweir     /**
309cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
310cdf0e10cSrcweir     */
_getBytes()311cdf0e10cSrcweir     public void _getBytes() {
312cdf0e10cSrcweir         boolean result = true ;
313cdf0e10cSrcweir         int col = findColumnOfType(byte[].class) ;
314cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
315cdf0e10cSrcweir         else {
316cdf0e10cSrcweir             try {
317cdf0e10cSrcweir                 byte[] getVal = oObj.getBytes(col) ;
318cdf0e10cSrcweir             } catch (SQLException e) {
319cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
320cdf0e10cSrcweir                 log.println(e) ;
321cdf0e10cSrcweir                 result = false ;
322cdf0e10cSrcweir             }
323cdf0e10cSrcweir         }
324cdf0e10cSrcweir 
325cdf0e10cSrcweir         tRes.tested("getBytes()", result) ;
326cdf0e10cSrcweir     }
327cdf0e10cSrcweir 
328cdf0e10cSrcweir     /**
329cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
330cdf0e10cSrcweir     */
_getDate()331cdf0e10cSrcweir     public void _getDate() {
332cdf0e10cSrcweir         boolean result = true ;
333cdf0e10cSrcweir         int col = findColumnOfType(Date.class) ;
334cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
335cdf0e10cSrcweir         else {
336cdf0e10cSrcweir             try {
337cdf0e10cSrcweir                 Date getVal = oObj.getDate(col) ;
338cdf0e10cSrcweir             } catch (SQLException e) {
339cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
340cdf0e10cSrcweir                 log.println(e) ;
341cdf0e10cSrcweir                 result = false ;
342cdf0e10cSrcweir             }
343cdf0e10cSrcweir         }
344cdf0e10cSrcweir 
345cdf0e10cSrcweir         tRes.tested("getDate()", result) ;
346cdf0e10cSrcweir     }
347cdf0e10cSrcweir 
348cdf0e10cSrcweir     /**
349cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
350cdf0e10cSrcweir     */
_getTime()351cdf0e10cSrcweir     public void _getTime() {
352cdf0e10cSrcweir         boolean result = true ;
353cdf0e10cSrcweir         int col = findColumnOfType(Time.class) ;
354cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
355cdf0e10cSrcweir         else {
356cdf0e10cSrcweir             try {
357cdf0e10cSrcweir                 Time getVal = oObj.getTime(col) ;
358cdf0e10cSrcweir             } catch (SQLException e) {
359cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
360cdf0e10cSrcweir                 log.println(e) ;
361cdf0e10cSrcweir                 result = false ;
362cdf0e10cSrcweir             }
363cdf0e10cSrcweir         }
364cdf0e10cSrcweir 
365cdf0e10cSrcweir         tRes.tested("getTime()", result) ;
366cdf0e10cSrcweir     }
367cdf0e10cSrcweir 
368cdf0e10cSrcweir     /**
369cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
370cdf0e10cSrcweir     */
_getTimestamp()371cdf0e10cSrcweir     public void _getTimestamp() {
372cdf0e10cSrcweir         boolean result = true ;
373cdf0e10cSrcweir         int col = findColumnOfType(DateTime.class) ;
374cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
375cdf0e10cSrcweir         else {
376cdf0e10cSrcweir             try {
377cdf0e10cSrcweir                 DateTime getVal = oObj.getTimestamp(col) ;
378cdf0e10cSrcweir             } catch (SQLException e) {
379cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
380cdf0e10cSrcweir                 log.println(e) ;
381cdf0e10cSrcweir                 result = false ;
382cdf0e10cSrcweir             }
383cdf0e10cSrcweir         }
384cdf0e10cSrcweir 
385cdf0e10cSrcweir         tRes.tested("getTimestamp()", result) ;
386cdf0e10cSrcweir     }
387cdf0e10cSrcweir 
388cdf0e10cSrcweir     /**
389cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
390cdf0e10cSrcweir     */
_getBinaryStream()391cdf0e10cSrcweir     public void _getBinaryStream() {
392cdf0e10cSrcweir         boolean result = true ;
393cdf0e10cSrcweir         int col = findColumnOfType(XDataInputStream.class) ;
394cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
395cdf0e10cSrcweir         else {
396cdf0e10cSrcweir             try {
397cdf0e10cSrcweir                 XInputStream getVal = oObj.getBinaryStream(col) ;
398cdf0e10cSrcweir             } catch (SQLException e) {
399cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
400cdf0e10cSrcweir                 log.println(e) ;
401cdf0e10cSrcweir                 result = false ;
402cdf0e10cSrcweir             }
403cdf0e10cSrcweir         }
404cdf0e10cSrcweir 
405cdf0e10cSrcweir         tRes.tested("getBinaryStream()", result) ;
406cdf0e10cSrcweir     }
407cdf0e10cSrcweir 
408cdf0e10cSrcweir     /**
409cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
410cdf0e10cSrcweir     */
_getCharacterStream()411cdf0e10cSrcweir     public void _getCharacterStream() {
412cdf0e10cSrcweir         boolean result = true ;
413cdf0e10cSrcweir         int col = findColumnOfType(XTextInputStream.class) ;
414cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
415cdf0e10cSrcweir         else {
416cdf0e10cSrcweir             try {
417cdf0e10cSrcweir                 XInputStream getVal = oObj.getCharacterStream(col) ;
418cdf0e10cSrcweir             } catch (SQLException e) {
419cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
420cdf0e10cSrcweir                 log.println(e) ;
421cdf0e10cSrcweir                 result = false ;
422cdf0e10cSrcweir             }
423cdf0e10cSrcweir         }
424cdf0e10cSrcweir 
425cdf0e10cSrcweir         tRes.tested("getCharacterStream()", result) ;
426cdf0e10cSrcweir     }
427cdf0e10cSrcweir 
428cdf0e10cSrcweir     /**
429cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
430cdf0e10cSrcweir     */
_getObject()431cdf0e10cSrcweir     public void _getObject() {
432cdf0e10cSrcweir         boolean result = true ;
433cdf0e10cSrcweir         int col = findColumnOfType(Object[].class) ;
434cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
435cdf0e10cSrcweir         else {
436cdf0e10cSrcweir             try {
437cdf0e10cSrcweir                 Object getVal = oObj.getObject(col, null) ;
438cdf0e10cSrcweir             } catch (SQLException e) {
439cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
440cdf0e10cSrcweir                 log.println(e) ;
441cdf0e10cSrcweir                 result = false ;
442cdf0e10cSrcweir             }
443cdf0e10cSrcweir         }
444cdf0e10cSrcweir 
445cdf0e10cSrcweir         tRes.tested("getObject()", result) ;
446cdf0e10cSrcweir     }
447cdf0e10cSrcweir 
448cdf0e10cSrcweir     /**
449cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
450cdf0e10cSrcweir     */
_getRef()451cdf0e10cSrcweir     public void _getRef() {
452cdf0e10cSrcweir         boolean result = true ;
453cdf0e10cSrcweir         int col = findColumnOfType(XRef.class) ;
454cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
455cdf0e10cSrcweir         else {
456cdf0e10cSrcweir             try {
457cdf0e10cSrcweir                 XRef getVal = oObj.getRef(col) ;
458cdf0e10cSrcweir             } catch (SQLException e) {
459cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
460cdf0e10cSrcweir                 log.println(e) ;
461cdf0e10cSrcweir                 result = false ;
462cdf0e10cSrcweir             }
463cdf0e10cSrcweir         }
464cdf0e10cSrcweir 
465cdf0e10cSrcweir         tRes.tested("getRef()", result) ;
466cdf0e10cSrcweir     }
467cdf0e10cSrcweir 
468cdf0e10cSrcweir     /**
469cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
470cdf0e10cSrcweir     */
_getBlob()471cdf0e10cSrcweir     public void _getBlob() {
472cdf0e10cSrcweir         boolean result = true ;
473cdf0e10cSrcweir         int col = findColumnOfType(XBlob.class) ;
474cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
475cdf0e10cSrcweir         else {
476cdf0e10cSrcweir             try {
477cdf0e10cSrcweir                 XBlob getVal = oObj.getBlob(col) ;
478cdf0e10cSrcweir             } catch (SQLException e) {
479cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
480cdf0e10cSrcweir                 log.println(e) ;
481cdf0e10cSrcweir                 result = false ;
482cdf0e10cSrcweir             }
483cdf0e10cSrcweir         }
484cdf0e10cSrcweir 
485cdf0e10cSrcweir         tRes.tested("getBlob()", result) ;
486cdf0e10cSrcweir     }
487cdf0e10cSrcweir 
488cdf0e10cSrcweir     /**
489cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
490cdf0e10cSrcweir     */
_getClob()491cdf0e10cSrcweir     public void _getClob() {
492cdf0e10cSrcweir         boolean result = true ;
493cdf0e10cSrcweir         int col = findColumnOfType(XClob.class) ;
494cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
495cdf0e10cSrcweir         else {
496cdf0e10cSrcweir             try {
497cdf0e10cSrcweir                 XClob getVal = oObj.getClob(col) ;
498cdf0e10cSrcweir             } catch (SQLException e) {
499cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
500cdf0e10cSrcweir                 log.println(e) ;
501cdf0e10cSrcweir                 result = false ;
502cdf0e10cSrcweir             }
503cdf0e10cSrcweir         }
504cdf0e10cSrcweir 
505cdf0e10cSrcweir         tRes.tested("getClob()", result) ;
506cdf0e10cSrcweir     }
507cdf0e10cSrcweir 
508cdf0e10cSrcweir     /**
509cdf0e10cSrcweir     * Has <b>OK</b> status if no exceptions occured in method call.
510cdf0e10cSrcweir     */
_getArray()511cdf0e10cSrcweir     public void _getArray() {
512cdf0e10cSrcweir         boolean result = true ;
513cdf0e10cSrcweir         int col = findColumnOfType(XArray.class) ;
514cdf0e10cSrcweir         if (col < 0) log.println("Type not found in relation: not tested");
515cdf0e10cSrcweir         else {
516cdf0e10cSrcweir             try {
517cdf0e10cSrcweir                 XArray getVal = oObj.getArray(col) ;
518cdf0e10cSrcweir             } catch (SQLException e) {
519cdf0e10cSrcweir                 log.println("Unexpected SQL exception:") ;
520cdf0e10cSrcweir                 log.println(e) ;
521cdf0e10cSrcweir                 result = false ;
522cdf0e10cSrcweir             }
523cdf0e10cSrcweir         }
524cdf0e10cSrcweir 
525cdf0e10cSrcweir         tRes.tested("getArray()", result) ;
526cdf0e10cSrcweir     }
527cdf0e10cSrcweir 
528cdf0e10cSrcweir     /**
529cdf0e10cSrcweir     * Finds in relation vector index of column of the appropriate
530cdf0e10cSrcweir     * type.
531cdf0e10cSrcweir     */
findColumnOfType(Class clz)532cdf0e10cSrcweir     protected int findColumnOfType(Class clz) {
533cdf0e10cSrcweir 
534cdf0e10cSrcweir         for (int i = 0; i < data.size(); i++)
535cdf0e10cSrcweir             if (clz.isInstance(data.get(i))) return i + 1 ;
536cdf0e10cSrcweir         return -1 ;
537cdf0e10cSrcweir     }
538cdf0e10cSrcweir }  // finish class _XRow
539cdf0e10cSrcweir 
540cdf0e10cSrcweir 
541