1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?> 2*b1cdbd2cSJim Jagielski<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3*b1cdbd2cSJim Jagielski<script:module xmlns:script="http://openoffice.org/2000/script" script:name="sdbc_XRow" script:language="StarBasic"> 4*b1cdbd2cSJim Jagielski 5*b1cdbd2cSJim Jagielski 6*b1cdbd2cSJim Jagielski'************************************************************************* 7*b1cdbd2cSJim Jagielski' 8*b1cdbd2cSJim Jagielski' Licensed to the Apache Software Foundation (ASF) under one 9*b1cdbd2cSJim Jagielski' or more contributor license agreements. See the NOTICE file 10*b1cdbd2cSJim Jagielski' distributed with this work for additional information 11*b1cdbd2cSJim Jagielski' regarding copyright ownership. The ASF licenses this file 12*b1cdbd2cSJim Jagielski' to you under the Apache License, Version 2.0 (the 13*b1cdbd2cSJim Jagielski' "License"); you may not use this file except in compliance 14*b1cdbd2cSJim Jagielski' with the License. You may obtain a copy of the License at 15*b1cdbd2cSJim Jagielski' 16*b1cdbd2cSJim Jagielski' http://www.apache.org/licenses/LICENSE-2.0 17*b1cdbd2cSJim Jagielski' 18*b1cdbd2cSJim Jagielski' Unless required by applicable law or agreed to in writing, 19*b1cdbd2cSJim Jagielski' software distributed under the License is distributed on an 20*b1cdbd2cSJim Jagielski' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21*b1cdbd2cSJim Jagielski' KIND, either express or implied. See the License for the 22*b1cdbd2cSJim Jagielski' specific language governing permissions and limitations 23*b1cdbd2cSJim Jagielski' under the License. 24*b1cdbd2cSJim Jagielski' 25*b1cdbd2cSJim Jagielski'************************************************************************* 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski 28*b1cdbd2cSJim Jagielski 29*b1cdbd2cSJim Jagielski 30*b1cdbd2cSJim Jagielski 31*b1cdbd2cSJim Jagielski' Be sure that all variables are dimensioned: 32*b1cdbd2cSJim Jagielskioption explicit 33*b1cdbd2cSJim Jagielski 34*b1cdbd2cSJim Jagielski'************************************************************************* 35*b1cdbd2cSJim Jagielski' This Interface/Service test depends on the following GLOBAL variables, 36*b1cdbd2cSJim Jagielski' which must be specified in the object creation: 37*b1cdbd2cSJim Jagielski 38*b1cdbd2cSJim Jagielski' - Global rowTypes As Variant 39*b1cdbd2cSJim Jagielski' Array of Strings with description of column types 40*b1cdbd2cSJim Jagielski 41*b1cdbd2cSJim Jagielski'************************************************************************* 42*b1cdbd2cSJim Jagielski 43*b1cdbd2cSJim Jagielski 44*b1cdbd2cSJim Jagielski 45*b1cdbd2cSJim Jagielski 46*b1cdbd2cSJim Jagielski 47*b1cdbd2cSJim Jagielski 48*b1cdbd2cSJim JagielskiSub RunTest() 49*b1cdbd2cSJim Jagielski 50*b1cdbd2cSJim Jagielski'************************************************************************* 51*b1cdbd2cSJim Jagielski' INTERFACE: 52*b1cdbd2cSJim Jagielski' com.sun.star.sdbc.XRow 53*b1cdbd2cSJim Jagielski'************************************************************************* 54*b1cdbd2cSJim JagielskiOn Error Goto ErrHndl 55*b1cdbd2cSJim Jagielski Dim bOK As Boolean 56*b1cdbd2cSJim Jagielski Dim i As Integer 57*b1cdbd2cSJim Jagielski Dim colType As String 58*b1cdbd2cSJim Jagielski 59*b1cdbd2cSJim Jagielski Test.StartMethod("getBoolean()") 60*b1cdbd2cSJim Jagielski bOK = true 61*b1cdbd2cSJim Jagielski colType = "boolean" 62*b1cdbd2cSJim Jagielski i = findColumn(colType) 63*b1cdbd2cSJim Jagielski if i >= 0 then 64*b1cdbd2cSJim Jagielski oObj.getBoolean(i) 65*b1cdbd2cSJim Jagielski else 66*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 67*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 68*b1cdbd2cSJim Jagielski end if 69*b1cdbd2cSJim Jagielski Test.MethodTested("getBoolean()", bOK) 70*b1cdbd2cSJim Jagielski 71*b1cdbd2cSJim Jagielski Test.StartMethod("getByte()") 72*b1cdbd2cSJim Jagielski bOK = true 73*b1cdbd2cSJim Jagielski colType = "byte" 74*b1cdbd2cSJim Jagielski i = findColumn(colType) 75*b1cdbd2cSJim Jagielski if i >= 0 then 76*b1cdbd2cSJim Jagielski oObj.getByte(i + 1) 77*b1cdbd2cSJim Jagielski else 78*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 79*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 80*b1cdbd2cSJim Jagielski end if 81*b1cdbd2cSJim Jagielski Test.MethodTested("getByte()", bOK) 82*b1cdbd2cSJim Jagielski 83*b1cdbd2cSJim Jagielski Test.StartMethod("getShort()") 84*b1cdbd2cSJim Jagielski bOK = true 85*b1cdbd2cSJim Jagielski colType = "short" 86*b1cdbd2cSJim Jagielski i = findColumn(colType) 87*b1cdbd2cSJim Jagielski if i >= 0 then 88*b1cdbd2cSJim Jagielski oObj.getShort(i + 1) 89*b1cdbd2cSJim Jagielski else 90*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 91*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 92*b1cdbd2cSJim Jagielski end if 93*b1cdbd2cSJim Jagielski Test.MethodTested("getShort()", bOK) 94*b1cdbd2cSJim Jagielski 95*b1cdbd2cSJim Jagielski Test.StartMethod("getInt()") 96*b1cdbd2cSJim Jagielski bOK = true 97*b1cdbd2cSJim Jagielski colType = "int" 98*b1cdbd2cSJim Jagielski i = findColumn(colType) 99*b1cdbd2cSJim Jagielski if i >= 0 then 100*b1cdbd2cSJim Jagielski oObj.getInt(i + 1) 101*b1cdbd2cSJim Jagielski else 102*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 103*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 104*b1cdbd2cSJim Jagielski end if 105*b1cdbd2cSJim Jagielski Test.MethodTested("getInt()", bOK) 106*b1cdbd2cSJim Jagielski 107*b1cdbd2cSJim Jagielski Test.StartMethod("getLong()") 108*b1cdbd2cSJim Jagielski bOK = true 109*b1cdbd2cSJim Jagielski colType = "long" 110*b1cdbd2cSJim Jagielski i = findColumn(colType) 111*b1cdbd2cSJim Jagielski if i >= 0 then 112*b1cdbd2cSJim Jagielski oObj.getLong(i + 1) 113*b1cdbd2cSJim Jagielski else 114*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 115*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 116*b1cdbd2cSJim Jagielski end if 117*b1cdbd2cSJim Jagielski Test.MethodTested("getLong()", bOK) 118*b1cdbd2cSJim Jagielski 119*b1cdbd2cSJim Jagielski Test.StartMethod("getFloat()") 120*b1cdbd2cSJim Jagielski bOK = true 121*b1cdbd2cSJim Jagielski colType = "float" 122*b1cdbd2cSJim Jagielski i = findColumn(colType) 123*b1cdbd2cSJim Jagielski if i >= 0 then 124*b1cdbd2cSJim Jagielski oObj.getFloat(i + 1) 125*b1cdbd2cSJim Jagielski else 126*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 127*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 128*b1cdbd2cSJim Jagielski end if 129*b1cdbd2cSJim Jagielski Test.MethodTested("getFloat()", bOK) 130*b1cdbd2cSJim Jagielski 131*b1cdbd2cSJim Jagielski Test.StartMethod("getDouble()") 132*b1cdbd2cSJim Jagielski bOK = true 133*b1cdbd2cSJim Jagielski colType = "double" 134*b1cdbd2cSJim Jagielski i = findColumn(colType) 135*b1cdbd2cSJim Jagielski if i >= 0 then 136*b1cdbd2cSJim Jagielski oObj.getDouble(i + 1) 137*b1cdbd2cSJim Jagielski else 138*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 139*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 140*b1cdbd2cSJim Jagielski end if 141*b1cdbd2cSJim Jagielski Test.MethodTested("getDouble()", bOK) 142*b1cdbd2cSJim Jagielski 143*b1cdbd2cSJim Jagielski Test.StartMethod("getString()") 144*b1cdbd2cSJim Jagielski bOK = true 145*b1cdbd2cSJim Jagielski colType = "string" 146*b1cdbd2cSJim Jagielski i = findColumn(colType) 147*b1cdbd2cSJim Jagielski if i >= 0 then 148*b1cdbd2cSJim Jagielski oObj.getString(i + 1) 149*b1cdbd2cSJim Jagielski else 150*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 151*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 152*b1cdbd2cSJim Jagielski end if 153*b1cdbd2cSJim Jagielski Test.MethodTested("getString()", bOK) 154*b1cdbd2cSJim Jagielski 155*b1cdbd2cSJim Jagielski Test.StartMethod("getBytes()") 156*b1cdbd2cSJim Jagielski bOK = true 157*b1cdbd2cSJim Jagielski colType = "bytes" 158*b1cdbd2cSJim Jagielski i = findColumn(colType) 159*b1cdbd2cSJim Jagielski if i >= 0 then 160*b1cdbd2cSJim Jagielski oObj.getBytes(i + 1) 161*b1cdbd2cSJim Jagielski else 162*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 163*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 164*b1cdbd2cSJim Jagielski end if 165*b1cdbd2cSJim Jagielski Test.MethodTested("getBytes()", bOK) 166*b1cdbd2cSJim Jagielski 167*b1cdbd2cSJim Jagielski Test.StartMethod("getDate()") 168*b1cdbd2cSJim Jagielski bOK = true 169*b1cdbd2cSJim Jagielski colType = "date" 170*b1cdbd2cSJim Jagielski i = findColumn(colType) 171*b1cdbd2cSJim Jagielski if i >= 0 then 172*b1cdbd2cSJim Jagielski oObj.getDate(i + 1) 173*b1cdbd2cSJim Jagielski else 174*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 175*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 176*b1cdbd2cSJim Jagielski end if 177*b1cdbd2cSJim Jagielski Test.MethodTested("getDate()", bOK) 178*b1cdbd2cSJim Jagielski 179*b1cdbd2cSJim Jagielski Test.StartMethod("getTime()") 180*b1cdbd2cSJim Jagielski bOK = true 181*b1cdbd2cSJim Jagielski colType = "time" 182*b1cdbd2cSJim Jagielski i = findColumn(colType) 183*b1cdbd2cSJim Jagielski if i >= 0 then 184*b1cdbd2cSJim Jagielski oObj.getTime(i + 1) 185*b1cdbd2cSJim Jagielski else 186*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 187*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 188*b1cdbd2cSJim Jagielski end if 189*b1cdbd2cSJim Jagielski Test.MethodTested("getTime()", bOK) 190*b1cdbd2cSJim Jagielski 191*b1cdbd2cSJim Jagielski Test.StartMethod("getTimestamp()") 192*b1cdbd2cSJim Jagielski bOK = true 193*b1cdbd2cSJim Jagielski colType = "timestamp" 194*b1cdbd2cSJim Jagielski i = findColumn(colType) 195*b1cdbd2cSJim Jagielski if i >= 0 then 196*b1cdbd2cSJim Jagielski oObj.getTimestamp(i + 1) 197*b1cdbd2cSJim Jagielski else 198*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 199*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 200*b1cdbd2cSJim Jagielski end if 201*b1cdbd2cSJim Jagielski Test.MethodTested("getTimestamp()", bOK) 202*b1cdbd2cSJim Jagielski 203*b1cdbd2cSJim Jagielski Test.StartMethod("getBinaryStream()") 204*b1cdbd2cSJim Jagielski bOK = true 205*b1cdbd2cSJim Jagielski colType = "binarystream" 206*b1cdbd2cSJim Jagielski i = findColumn(colType) 207*b1cdbd2cSJim Jagielski if i >= 0 then 208*b1cdbd2cSJim Jagielski oObj.getBinaryStream(i + 1) 209*b1cdbd2cSJim Jagielski else 210*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 211*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 212*b1cdbd2cSJim Jagielski end if 213*b1cdbd2cSJim Jagielski Test.MethodTested("getBinaryStream()", bOK) 214*b1cdbd2cSJim Jagielski 215*b1cdbd2cSJim Jagielski Test.StartMethod("getCharacterStream()") 216*b1cdbd2cSJim Jagielski bOK = true 217*b1cdbd2cSJim Jagielski colType = "characterstream" 218*b1cdbd2cSJim Jagielski i = findColumn(colType) 219*b1cdbd2cSJim Jagielski if i >= 0 then 220*b1cdbd2cSJim Jagielski oObj.getCharacterStream(i + 1) 221*b1cdbd2cSJim Jagielski else 222*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 223*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 224*b1cdbd2cSJim Jagielski end if 225*b1cdbd2cSJim Jagielski Test.MethodTested("getCharacterStream()", bOK) 226*b1cdbd2cSJim Jagielski 227*b1cdbd2cSJim Jagielski Test.StartMethod("getObject()") 228*b1cdbd2cSJim Jagielski bOK = true 229*b1cdbd2cSJim Jagielski colType = "object" 230*b1cdbd2cSJim Jagielski i = findColumn(colType) 231*b1cdbd2cSJim Jagielski if i >= 0 then 232*b1cdbd2cSJim Jagielski oObj.getObject(i + 1) 233*b1cdbd2cSJim Jagielski else 234*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 235*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 236*b1cdbd2cSJim Jagielski end if 237*b1cdbd2cSJim Jagielski Test.MethodTested("getObject()", bOK) 238*b1cdbd2cSJim Jagielski 239*b1cdbd2cSJim Jagielski Test.StartMethod("getRef()") 240*b1cdbd2cSJim Jagielski bOK = true 241*b1cdbd2cSJim Jagielski colType = "ref" 242*b1cdbd2cSJim Jagielski i = findColumn(colType) 243*b1cdbd2cSJim Jagielski if i >= 0 then 244*b1cdbd2cSJim Jagielski oObj.getRef(i + 1) 245*b1cdbd2cSJim Jagielski else 246*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 247*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 248*b1cdbd2cSJim Jagielski end if 249*b1cdbd2cSJim Jagielski Test.MethodTested("getRef()", bOK) 250*b1cdbd2cSJim Jagielski 251*b1cdbd2cSJim Jagielski Test.StartMethod("getBlob()") 252*b1cdbd2cSJim Jagielski bOK = true 253*b1cdbd2cSJim Jagielski colType = "blob" 254*b1cdbd2cSJim Jagielski i = findColumn(colType) 255*b1cdbd2cSJim Jagielski if i >= 0 then 256*b1cdbd2cSJim Jagielski oObj.getBlob(i + 1) 257*b1cdbd2cSJim Jagielski else 258*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 259*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 260*b1cdbd2cSJim Jagielski end if 261*b1cdbd2cSJim Jagielski Test.MethodTested("getBlob()", bOK) 262*b1cdbd2cSJim Jagielski 263*b1cdbd2cSJim Jagielski Test.StartMethod("getClob()") 264*b1cdbd2cSJim Jagielski bOK = true 265*b1cdbd2cSJim Jagielski colType = "clob" 266*b1cdbd2cSJim Jagielski i = findColumn(colType) 267*b1cdbd2cSJim Jagielski if i >= 0 then 268*b1cdbd2cSJim Jagielski oObj.getClob(i + 1) 269*b1cdbd2cSJim Jagielski else 270*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 271*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 272*b1cdbd2cSJim Jagielski end if 273*b1cdbd2cSJim Jagielski Test.MethodTested("getClob()", bOK) 274*b1cdbd2cSJim Jagielski 275*b1cdbd2cSJim Jagielski Test.StartMethod("getArray()") 276*b1cdbd2cSJim Jagielski bOK = true 277*b1cdbd2cSJim Jagielski colType = "array" 278*b1cdbd2cSJim Jagielski i = findColumn(colType) 279*b1cdbd2cSJim Jagielski if i >= 0 then 280*b1cdbd2cSJim Jagielski oObj.getArray(i + 1) 281*b1cdbd2cSJim Jagielski else 282*b1cdbd2cSJim Jagielski Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.") 283*b1cdbd2cSJim Jagielski Out.Log("Nevertheless status is OK") 284*b1cdbd2cSJim Jagielski end if 285*b1cdbd2cSJim Jagielski Test.MethodTested("getArray()", bOK) 286*b1cdbd2cSJim Jagielski 287*b1cdbd2cSJim Jagielski 288*b1cdbd2cSJim Jagielski Test.StartMethod("wasNull()") 289*b1cdbd2cSJim Jagielski bOK = true 290*b1cdbd2cSJim Jagielski oObj.wasNull() 291*b1cdbd2cSJim Jagielski Test.MethodTested("wasNull()", bOK) 292*b1cdbd2cSJim Jagielski 293*b1cdbd2cSJim JagielskiExit Sub 294*b1cdbd2cSJim JagielskiErrHndl: 295*b1cdbd2cSJim Jagielski Test.Exception() 296*b1cdbd2cSJim Jagielski bOK = false 297*b1cdbd2cSJim Jagielski resume next 298*b1cdbd2cSJim JagielskiEnd Sub 299*b1cdbd2cSJim Jagielski 300*b1cdbd2cSJim JagielskiFunction findColumn(cType As String) As Integer 301*b1cdbd2cSJim Jagielski Dim i As Integer 302*b1cdbd2cSJim Jagielski 303*b1cdbd2cSJim Jagielski for i = lbound(rowTypes()) to ubound(rowTypes()) 304*b1cdbd2cSJim Jagielski if rowTypes(i) = cType then 305*b1cdbd2cSJim Jagielski findColumn() = rowTypesCol(i) 306*b1cdbd2cSJim Jagielski exit function 307*b1cdbd2cSJim Jagielski end if 308*b1cdbd2cSJim Jagielski next i 309*b1cdbd2cSJim Jagielski 310*b1cdbd2cSJim Jagielski findColumn() = -1 311*b1cdbd2cSJim JagielskiEnd function 312*b1cdbd2cSJim Jagielski</script:module> 313