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