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