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_XRowUpdate" 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'       must be an array of Strings with description of column types
40cdf0e10cSrcweir'     - Global rowTypesCol As Variant
41cdf0e10cSrcweir'       corresponding column numbers
42cdf0e10cSrcweir
43cdf0e10cSrcweir'*************************************************************************
44cdf0e10cSrcweir
45cdf0e10cSrcweir
46cdf0e10cSrcweir
47cdf0e10cSrcweir
48cdf0e10cSrcweir
49cdf0e10cSrcweir
50cdf0e10cSrcweirSub RunTest()
51cdf0e10cSrcweir
52cdf0e10cSrcweir'*************************************************************************
53cdf0e10cSrcweir' INTERFACE:
54cdf0e10cSrcweir' com.sun.star.sdbc.XRowUpdate
55cdf0e10cSrcweir'*************************************************************************
56cdf0e10cSrcweirOn Error Goto ErrHndl
57cdf0e10cSrcweir    Dim bOK As Boolean, bNullOK As Boolean
58cdf0e10cSrcweir    Dim i As Integer
59cdf0e10cSrcweir    Dim getV As Variant, newV As Variant, resV As Variant
60cdf0e10cSrcweir    Dim colType As String
61cdf0e10cSrcweir
62cdf0e10cSrcweir    if NOT hasUnoInterfaces(oObj, "com.sun.star.sdbc.XRow") then
63cdf0e10cSrcweir        Out.Log("The interface com.sun.star.sdbc.XRow isn't supported by the component.")
64cdf0e10cSrcweir        Out.Log("The test must be upgraded !!!")
65cdf0e10cSrcweir        exit Sub
66cdf0e10cSrcweir    end if
67cdf0e10cSrcweir
68cdf0e10cSrcweir    Test.RecreateObj()
69cdf0e10cSrcweir
70cdf0e10cSrcweir    bNullOK = true
71cdf0e10cSrcweir
72cdf0e10cSrcweir    Test.StartMethod("updateBoolean()")
73cdf0e10cSrcweir    colType = "boolean"
74cdf0e10cSrcweir    i = findColumn(colType)
75cdf0e10cSrcweir    if i >= 0 then
76cdf0e10cSrcweir        bOK = true
77cdf0e10cSrcweir        getV = oObj.getBoolean(i+1)
78cdf0e10cSrcweir        newV = NOT getV
79cdf0e10cSrcweir        oObj.updateBoolean(i+1, newV)
80cdf0e10cSrcweir        resV = oObj.getBoolean(i+1)
81cdf0e10cSrcweir        Out.Log("Was: " + getv + ", New: " + newV + ", Res: " + resV)
82cdf0e10cSrcweir        bOK = bOK AND (resV = newV)
83cdf0e10cSrcweir        Test.MethodTested("updateBoolean()", bOK)
84cdf0e10cSrcweir
85cdf0e10cSrcweir        oObj.updateNull(i+1)
86cdf0e10cSrcweir        oObj.getBoolean(i+1)
87cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
88cdf0e10cSrcweir    else
89cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
90cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
91cdf0e10cSrcweir        Test.MethodTested("updateBoolean()", true)
92cdf0e10cSrcweir    end if
93cdf0e10cSrcweir
94cdf0e10cSrcweir    Test.StartMethod("updateByte()")
95cdf0e10cSrcweir    colType = "byte"
96cdf0e10cSrcweir    i = findColumn(colType)
97cdf0e10cSrcweir    if i >= 0 then
98cdf0e10cSrcweir        bOK = true
99cdf0e10cSrcweir        getV = oObj.getByte(i+1)
100cdf0e10cSrcweir        newV = getV + 1
101cdf0e10cSrcweir        oObj.updateByte(i+1, newV)
102cdf0e10cSrcweir        resV = oObj.getByte(i+1)
103cdf0e10cSrcweir        Out.Log("Was: " + getv + ", New: " + newV + ", Res: " + resV)
104cdf0e10cSrcweir        bOK = bOK AND (resV = newV)
105cdf0e10cSrcweir        Test.MethodTested("updateByte()", bOK)
106cdf0e10cSrcweir
107cdf0e10cSrcweir        oObj.updateNull(i+1)
108cdf0e10cSrcweir        oObj.getByte(i+1)
109cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
110cdf0e10cSrcweir    else
111cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
112cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
113cdf0e10cSrcweir        Test.MethodTested("updateByte()", true)
114cdf0e10cSrcweir    end if
115cdf0e10cSrcweir
116cdf0e10cSrcweir    Test.StartMethod("updateShort()")
117cdf0e10cSrcweir    colType = "short"
118cdf0e10cSrcweir    i = findColumn(colType)
119cdf0e10cSrcweir    if i >= 0 then
120cdf0e10cSrcweir        bOK = true
121cdf0e10cSrcweir        getV = oObj.getShort(i+1)
122cdf0e10cSrcweir        newV = getV + 1
123cdf0e10cSrcweir        oObj.updateShort(i+1, newV)
124cdf0e10cSrcweir        resV = oObj.getShort(i+1)
125cdf0e10cSrcweir        Out.Log("Was: " + getv + ", New: " + newV + ", Res: " + resV)
126cdf0e10cSrcweir        bOK = bOK AND (resV = newV)
127cdf0e10cSrcweir        Test.MethodTested("updateShort()", bOK)
128cdf0e10cSrcweir
129cdf0e10cSrcweir        oObj.updateNull(i+1)
130cdf0e10cSrcweir        oObj.getShort(i+1)
131cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
132cdf0e10cSrcweir    else
133cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
134cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
135cdf0e10cSrcweir        Test.MethodTested("updateShort()", true)
136cdf0e10cSrcweir    end if
137cdf0e10cSrcweir
138cdf0e10cSrcweir    Test.StartMethod("updateInt()")
139cdf0e10cSrcweir    colType = "int"
140cdf0e10cSrcweir    i = findColumn(colType)
141cdf0e10cSrcweir    if i >= 0 then
142cdf0e10cSrcweir        bOK = true
143cdf0e10cSrcweir        getV = oObj.getInt(i+1)
144cdf0e10cSrcweir        newV = getV + 1
145cdf0e10cSrcweir        oObj.updateInt(i+1, newV)
146cdf0e10cSrcweir        resV = oObj.getInt(i+1)
147cdf0e10cSrcweir        Out.Log("Was: " + getv + ", New: " + newV + ", Res: " + resV)
148cdf0e10cSrcweir        bOK = bOK AND (resV = newV)
149cdf0e10cSrcweir        Test.MethodTested("updateInt()", bOK)
150cdf0e10cSrcweir
151cdf0e10cSrcweir        oObj.updateNull(i+1)
152cdf0e10cSrcweir        oObj.getInt(i+1)
153cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
154cdf0e10cSrcweir    else
155cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
156cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
157cdf0e10cSrcweir        Test.MethodTested("updateInt()", true)
158cdf0e10cSrcweir    end if
159cdf0e10cSrcweir
160cdf0e10cSrcweir    Test.StartMethod("updateLong()")
161cdf0e10cSrcweir    colType = "long"
162cdf0e10cSrcweir    i = findColumn(colType)
163cdf0e10cSrcweir    if i >= 0 then
164cdf0e10cSrcweir        bOK = true
165cdf0e10cSrcweir        getV = oObj.getLong(i+1)
166cdf0e10cSrcweir        newV = getV + 1
167cdf0e10cSrcweir        oObj.updateLong(i+1, newV)
168cdf0e10cSrcweir        resV = oObj.getLong(i+1)
169cdf0e10cSrcweir        Out.Log("Was: " + getv + ", New: " + newV + ", Res: " + resV)
170cdf0e10cSrcweir        bOK = bOK AND (resV = newV)
171cdf0e10cSrcweir        Test.MethodTested("updateLong()", bOK)
172cdf0e10cSrcweir
173cdf0e10cSrcweir        oObj.updateNull(i+1)
174cdf0e10cSrcweir        oObj.getLong(i+1)
175cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
176cdf0e10cSrcweir    else
177cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
178cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
179cdf0e10cSrcweir        Test.MethodTested("updateLong()", true)
180cdf0e10cSrcweir    end if
181cdf0e10cSrcweir
182cdf0e10cSrcweir    Test.StartMethod("updateFloat()")
183cdf0e10cSrcweir    colType = "float"
184cdf0e10cSrcweir    i = findColumn(colType)
185cdf0e10cSrcweir    if i >= 0 then
186cdf0e10cSrcweir        bOK = true
187cdf0e10cSrcweir        getV = oObj.getFloat(i+1)
188cdf0e10cSrcweir        newV = getV + 1.3
189cdf0e10cSrcweir        oObj.updateFloat(i+1, newV)
190cdf0e10cSrcweir        resV = oObj.getFloat(i+1)
191cdf0e10cSrcweir        Out.Log("Was: " + getv + ", New: " + newV + ", Res: " + resV)
192cdf0e10cSrcweir        bOK = bOK AND (resV = newV)
193cdf0e10cSrcweir        Test.MethodTested("updateFloat()", bOK)
194cdf0e10cSrcweir
195cdf0e10cSrcweir        oObj.updateNull(i+1)
196cdf0e10cSrcweir        oObj.getFloat(i+1)
197cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
198cdf0e10cSrcweir    else
199cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
200cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
201cdf0e10cSrcweir        Test.MethodTested("updateFloat()", true)
202cdf0e10cSrcweir    end if
203cdf0e10cSrcweir
204cdf0e10cSrcweir    Test.StartMethod("updateDouble()")
205cdf0e10cSrcweir    colType = "double"
206cdf0e10cSrcweir    i = findColumn(colType)
207cdf0e10cSrcweir    if i >= 0 then
208cdf0e10cSrcweir        bOK = true
209cdf0e10cSrcweir        getV = oObj.getDouble(i+1)
210cdf0e10cSrcweir        newV = getV + 1.5
211cdf0e10cSrcweir        oObj.updateDouble(i+1, newV)
212cdf0e10cSrcweir        resV = oObj.getDouble(i+1)
213cdf0e10cSrcweir        Out.Log("Was: " + getv + ", New: " + newV + ", Res: " + resV)
214cdf0e10cSrcweir        bOK = bOK AND (resV = newV)
215cdf0e10cSrcweir        Test.MethodTested("updateDouble()", bOK)
216cdf0e10cSrcweir
217cdf0e10cSrcweir        oObj.updateNull(i+1)
218cdf0e10cSrcweir        oObj.getDouble(i+1)
219cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
220cdf0e10cSrcweir    else
221cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
222cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
223cdf0e10cSrcweir        Test.MethodTested("updateDouble()", true)
224cdf0e10cSrcweir    end if
225cdf0e10cSrcweir
226cdf0e10cSrcweir    Test.StartMethod("updateString()")
227cdf0e10cSrcweir    colType = "string"
228cdf0e10cSrcweir    i = findColumn(colType)
229cdf0e10cSrcweir    if i >= 0 then
230cdf0e10cSrcweir        bOK = true
231cdf0e10cSrcweir        getV = oObj.getString(i+1)
232cdf0e10cSrcweir        newV = "_" + getV
233cdf0e10cSrcweir        oObj.updateString(i+1, newV)
234cdf0e10cSrcweir        resV = oObj.getString(i+1)
235cdf0e10cSrcweir        Out.Log("Was: '" + getv + "', New: '" + newV + "', Res: '" + resV + "'")
236cdf0e10cSrcweir        bOK = bOK AND (resV = newV)
237cdf0e10cSrcweir        Test.MethodTested("updateString()", bOK)
238cdf0e10cSrcweir
239cdf0e10cSrcweir        oObj.updateNull(i+1)
240cdf0e10cSrcweir        oObj.getString(i+1)
241cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
242cdf0e10cSrcweir    else
243cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
244cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
245cdf0e10cSrcweir        Test.MethodTested("updateString()", true)
246cdf0e10cSrcweir    end if
247cdf0e10cSrcweir
248cdf0e10cSrcweir    Test.StartMethod("updateBytes()")
249cdf0e10cSrcweir    colType = "bytes"
250cdf0e10cSrcweir    i = findColumn(colType)
251cdf0e10cSrcweir    if i >= 0 then
252cdf0e10cSrcweir        bOK = true
253cdf0e10cSrcweir        getV = oObj.getBytes(i+1)
254cdf0e10cSrcweir
255cdf0e10cSrcweir        if (oObj.wasNull() OR ubound(getV()) &lt; 0) then
256cdf0e10cSrcweir            newV = Array(1,2,3)
257cdf0e10cSrcweir        else
258cdf0e10cSrcweir            newV = getV
259cdf0e10cSrcweir            newV(0) = newV(0) + 1
260cdf0e10cSrcweir        end if
261cdf0e10cSrcweir
262cdf0e10cSrcweir        oObj.updateBytes(i+1, newV)
263cdf0e10cSrcweir        resV = oObj.getBytes(i+1)
264cdf0e10cSrcweir
265cdf0e10cSrcweir        Out.Log("Was: " + getv(0) + ", New: " + newV(0) + ", Res: " + resV(0))
266cdf0e10cSrcweir        bOK = bOK AND (resV(0) = newV(0))
267cdf0e10cSrcweir        Test.MethodTested("updateBytes()", bOK)
268cdf0e10cSrcweir
269cdf0e10cSrcweir        oObj.updateNull(i+1)
270cdf0e10cSrcweir        oObj.getBytes(i+1)
271cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
272cdf0e10cSrcweir    else
273cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
274cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
275cdf0e10cSrcweir        Test.MethodTested("updateBytes()", true)
276cdf0e10cSrcweir    end if
277cdf0e10cSrcweir
278cdf0e10cSrcweir
279cdf0e10cSrcweir    Dim dat As com.sun.star.util.Date
280cdf0e10cSrcweir    Test.StartMethod("updateDate()")
281cdf0e10cSrcweir    colType = "date"
282cdf0e10cSrcweir    i = findColumn(colType)
283cdf0e10cSrcweir    if i >= 0 then
284cdf0e10cSrcweir        bOK = true
285cdf0e10cSrcweir        getV = oObj.getDate(i+1)
286cdf0e10cSrcweir        if (oObj.wasNull() OR isNull(getV)) then
287cdf0e10cSrcweir            newV = dat
288cdf0e10cSrcweir        else
289cdf0e10cSrcweir            newV = getV
290cdf0e10cSrcweir            newV.Year = newV.Year + 1
291cdf0e10cSrcweir        end if
292cdf0e10cSrcweir
293cdf0e10cSrcweir        oObj.updateDate(i+1, newV)
294cdf0e10cSrcweir        resV = oObj.getDate(i+1)
295cdf0e10cSrcweir        Out.Log("Was: '" + getv.Year + "', New: '" + newV.Year + "', Res: '" + resV.Year + "'")
296cdf0e10cSrcweir        bOK = bOK AND (resV.Year = newV.Year)
297cdf0e10cSrcweir        Test.MethodTested("updateDate()", bOK)
298cdf0e10cSrcweir
299cdf0e10cSrcweir        oObj.updateNull(i+1)
300cdf0e10cSrcweir        oObj.getDate(i+1)
301cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
302cdf0e10cSrcweir    else
303cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
304cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
305cdf0e10cSrcweir        Test.MethodTested("updateDate()", true)
306cdf0e10cSrcweir    end if
307cdf0e10cSrcweir
308cdf0e10cSrcweir    Dim tim As com.sun.star.util.Time
309cdf0e10cSrcweir    Test.StartMethod("updateTime()")
310cdf0e10cSrcweir    colType = "time"
311cdf0e10cSrcweir    i = findColumn(colType)
312cdf0e10cSrcweir    if i >= 0 then
313cdf0e10cSrcweir        bOK = true
314cdf0e10cSrcweir        getV = oObj.getTime(i+1)
315cdf0e10cSrcweir        if (oObj.wasNull() OR isNull(getV)) then
316cdf0e10cSrcweir            newV = tim
317cdf0e10cSrcweir        else
318cdf0e10cSrcweir            newV = getV
319cdf0e10cSrcweir            newV.Seconds = newV.Seconds + 1
320cdf0e10cSrcweir        end if
321cdf0e10cSrcweir
322cdf0e10cSrcweir        oObj.updateTime(i+1, newV)
323cdf0e10cSrcweir        resV = oObj.getTime(i+1)
324cdf0e10cSrcweir        Out.Log("Was: '" + getv.Seconds + "', New: '" + newV.Seconds + "', Res: '" + resV.Seconds + "'")
325cdf0e10cSrcweir        bOK = bOK AND (resV.Seconds = newV.Seconds)
326cdf0e10cSrcweir        Test.MethodTested("updateTime()", bOK)
327cdf0e10cSrcweir
328cdf0e10cSrcweir        oObj.updateNull(i+1)
329cdf0e10cSrcweir        oObj.getTime(i+1)
330cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
331cdf0e10cSrcweir    else
332cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
333cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
334cdf0e10cSrcweir        Test.MethodTested("updateTime()", true)
335cdf0e10cSrcweir    end if
336cdf0e10cSrcweir
337cdf0e10cSrcweir    Dim dattm As com.sun.star.util.DateTime
338cdf0e10cSrcweir    Test.StartMethod("updateTimestamp()")
339cdf0e10cSrcweir    colType = "timestamp"
340cdf0e10cSrcweir    i = findColumn(colType)
341cdf0e10cSrcweir    if i >= 0 then
342cdf0e10cSrcweir        bOK = true
343cdf0e10cSrcweir        getV = oObj.getTimestamp(i+1)
344cdf0e10cSrcweir        if (oObj.wasNull() OR isNull(getV)) then
345cdf0e10cSrcweir            newV = dattm
346cdf0e10cSrcweir        else
347cdf0e10cSrcweir            newV = getV
348cdf0e10cSrcweir            newV.Year = newV.Year + 1
349cdf0e10cSrcweir        end if
350cdf0e10cSrcweir
351cdf0e10cSrcweir        oObj.updateTimestamp(i+1, newV)
352cdf0e10cSrcweir        resV = oObj.getTimestamp(i+1)
353cdf0e10cSrcweir        Out.Log("Was: '" + getv.Year + "', New: '" + newV.Year + "', Res: '" + resV.Year + "'")
354cdf0e10cSrcweir        bOK = bOK AND (resV.Year = newV.Year)
355cdf0e10cSrcweir        Test.MethodTested("updateTimestamp()", bOK)
356cdf0e10cSrcweir
357cdf0e10cSrcweir        oObj.updateNull(i+1)
358cdf0e10cSrcweir        oObj.getTimestamp(i+1)
359cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
360cdf0e10cSrcweir    else
361cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
362cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
363cdf0e10cSrcweir        Test.MethodTested("updateTimestamp()", true)
364cdf0e10cSrcweir    end if
365cdf0e10cSrcweir
366cdf0e10cSrcweir    Dim bytes As Variant, nBytes As Long
367cdf0e10cSrcweir    Test.StartMethod("updateCharacterStream()")
368cdf0e10cSrcweir    colType = "characterstream"
369cdf0e10cSrcweir    i = findColumn(colType)
370cdf0e10cSrcweir    if i >= 0 then
371cdf0e10cSrcweir        bOK = true
372cdf0e10cSrcweir        newV = createUnoService("com.sun.star.io.Pipe")
373cdf0e10cSrcweir        newV.writeBytes(Array(123, 234))
374cdf0e10cSrcweir        oObj.updateCharacterStream(i+1, newV)
375cdf0e10cSrcweir        resV = oObj.getCharacterStream(i+1)
376cdf0e10cSrcweir        'Out.Log("Was: '" + getv + "', New: '" + newV + "', Res: '" + resV + "'")
377cdf0e10cSrcweir        bOK = bOK AND NOT oObj.wasNull() AND NOT isNull(resV)
378cdf0e10cSrcweir
379cdf0e10cSrcweir        if bOK then
380cdf0e10cSrcweir            Out.Log("Testing further ...")
381cdf0e10cSrcweir            nBytes = resV.readBytes(bytes, 2)
382cdf0e10cSrcweir            bOK = bOK AND (nBytes = 2) AND (bytes(0) = 123) AND (bytes(1) = 234)
383cdf0e10cSrcweir        end if
384cdf0e10cSrcweir
385cdf0e10cSrcweir        Test.MethodTested("updateCharacterStream()", bOK)
386cdf0e10cSrcweir
387cdf0e10cSrcweir        oObj.updateNull(i+1)
388cdf0e10cSrcweir        oObj.getCharacterStream(i+1)
389cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
390cdf0e10cSrcweir    else
391cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
392cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
393cdf0e10cSrcweir        Test.MethodTested("updateCharacterStream()", true)
394cdf0e10cSrcweir    end if
395cdf0e10cSrcweir
396cdf0e10cSrcweir    Test.StartMethod("updateBinaryStream()")
397cdf0e10cSrcweir    colType = "binarystream"
398cdf0e10cSrcweir    i = findColumn(colType)
399cdf0e10cSrcweir    if i >= 0 then
400cdf0e10cSrcweir        bOK = true
401cdf0e10cSrcweir        newV = createUnoService("com.sun.star.io.Pipe")
402cdf0e10cSrcweir        newV.writeBytes(Array(123, 234))
403cdf0e10cSrcweir        oObj.updateBinaryStream(i+1, newV)
404cdf0e10cSrcweir        resV = oObj.getBinaryStream(i+1)
405cdf0e10cSrcweir        'Out.Log("Was: '" + getv + "', New: '" + newV + "', Res: '" + resV + "'")
406cdf0e10cSrcweir        bOK = bOK AND NOT oObj.wasNull() AND NOT isNull(resV)
407cdf0e10cSrcweir
408cdf0e10cSrcweir        if bOK then
409cdf0e10cSrcweir            Out.Log("Testing further ...")
410cdf0e10cSrcweir            nBytes = resV.readBytes(bytes, 2)
411cdf0e10cSrcweir            bOK = bOK AND (nBytes = 2) AND (bytes(0) = 123) AND (bytes(1) = 234)
412cdf0e10cSrcweir        end if
413cdf0e10cSrcweir
414cdf0e10cSrcweir        Test.MethodTested("updateBinaryStream()", bOK)
415cdf0e10cSrcweir
416cdf0e10cSrcweir        oObj.updateNull(i+1)
417cdf0e10cSrcweir        oObj.getBinaryStream(i+1)
418cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
419cdf0e10cSrcweir    else
420cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
421cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
422cdf0e10cSrcweir        Test.MethodTested("updateBinaryStream()", true)
423cdf0e10cSrcweir    end if
424cdf0e10cSrcweir
425cdf0e10cSrcweir    Test.StartMethod("updateObject()")
426cdf0e10cSrcweir    colType = "object"
427cdf0e10cSrcweir    i = findColumn(colType)
428cdf0e10cSrcweir    if i >= 0 then
429cdf0e10cSrcweir        bOK = true
430cdf0e10cSrcweir        getV = oObj.getObject(i+1)
431cdf0e10cSrcweir        if (NOT hasUnoInterfaces(getV, "com.sun.star.io.XInputStream")) then
432cdf0e10cSrcweir            newV = createUnoService("com.sun.star.io.DataInputStream")
433cdf0e10cSrcweir        else
434cdf0e10cSrcweir            newV = createUnoService("com.sun.star.io.DataOutputStream")
435cdf0e10cSrcweir        end if
436cdf0e10cSrcweir
437cdf0e10cSrcweir        oObj.updateObject(i+1, newV)
438cdf0e10cSrcweir        resV = oObj.getObject(i+1)
439cdf0e10cSrcweir
440cdf0e10cSrcweir        bOK = bOK AND (hasUnoInterfaces(newV, "com.sun.star.io.XInputStream") = _
441cdf0e10cSrcweir                       hasUnoInterfaces(resV, "com.sun.star.io.XInputStream")) AND _
442cdf0e10cSrcweir                      (hasUnoInterfaces(newV, "com.sun.star.io.XOutputStream") = _
443cdf0e10cSrcweir                       hasUnoInterfaces(resV, "com.sun.star.io.XOutputStream"))
444cdf0e10cSrcweir
445cdf0e10cSrcweir        Test.MethodTested("updateObject()", bOK)
446cdf0e10cSrcweir
447cdf0e10cSrcweir        oObj.updateNull(i+1)
448cdf0e10cSrcweir        oObj.getObject(i+1)
449cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
450cdf0e10cSrcweir    else
451cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
452cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
453cdf0e10cSrcweir        Test.MethodTested("updateObject()", true)
454cdf0e10cSrcweir    end if
455cdf0e10cSrcweir
456cdf0e10cSrcweir    Test.StartMethod("updateNumericObject()")
457cdf0e10cSrcweir    colType = "numericobject"
458cdf0e10cSrcweir    i = findColumn(colType)
459cdf0e10cSrcweir    if i >= 0 then
460cdf0e10cSrcweir        bOK = true
461cdf0e10cSrcweir        getV = oObj.getNumericObject(i+1)
462cdf0e10cSrcweir        if (NOT hasUnoInterfaces(getV, "com.sun.star.io.XInputStream")) then
463cdf0e10cSrcweir            newV = createUnoService("com.sun.star.io.DataInputStream")
464cdf0e10cSrcweir        else
465cdf0e10cSrcweir            newV = createUnoService("com.sun.star.io.DataOutputStream")
466cdf0e10cSrcweir        end if
467cdf0e10cSrcweir
468cdf0e10cSrcweir        oObj.updateNumericObject(i+1, newV, 0)
469cdf0e10cSrcweir        resV = oObj.getNumericObject(i+1)
470cdf0e10cSrcweir
471cdf0e10cSrcweir        bOK = bOK AND (hasUnoInterfaces(newV, "com.sun.star.io.XInputStream") = _
472cdf0e10cSrcweir                       hasUnoInterfaces(resV, "com.sun.star.io.XInputStream")) AND _
473cdf0e10cSrcweir                      (hasUnoInterfaces(newV, "com.sun.star.io.XOutputStream") = _
474cdf0e10cSrcweir                       hasUnoInterfaces(resV, "com.sun.star.io.XOutputStream"))
475cdf0e10cSrcweir
476cdf0e10cSrcweir        Test.MethodTested("updateNumericObject()", bOK)
477cdf0e10cSrcweir
478cdf0e10cSrcweir        oObj.updateNull(i+1)
479cdf0e10cSrcweir        oObj.getNumericObject(i+1)
480cdf0e10cSrcweir        bNullOK = bNullOK AND oObj.wasNull()
481cdf0e10cSrcweir    else
482cdf0e10cSrcweir        Out.Log("!!! Column of type '" + colType + "' is not found. No test performed.")
483cdf0e10cSrcweir        Out.Log("Nevertheless status is OK")
484cdf0e10cSrcweir        Test.MethodTested("updateNumericObject()", true)
485cdf0e10cSrcweir    end if
486cdf0e10cSrcweir
487cdf0e10cSrcweir    Test.StartMethod("updateNull()")
488cdf0e10cSrcweir    Test.MethodTested("updateNull()", bNullOK)
489cdf0e10cSrcweir
490cdf0e10cSrcweirExit Sub
491cdf0e10cSrcweirErrHndl:
492cdf0e10cSrcweir    Test.Exception()
493cdf0e10cSrcweir    bOK = false
494cdf0e10cSrcweir    resume next
495cdf0e10cSrcweirEnd Sub
496cdf0e10cSrcweir
497cdf0e10cSrcweirFunction findColumn(cType As String) As Integer
498cdf0e10cSrcweir    Dim i As Integer
499cdf0e10cSrcweir
500cdf0e10cSrcweir    for i = lbound(rowTypes()) to ubound(rowTypes())
501cdf0e10cSrcweir        if rowTypes(i) = cType then
502cdf0e10cSrcweir            findColumn() = rowTypesCol(i) - 1
503cdf0e10cSrcweir            exit function
504cdf0e10cSrcweir        end if
505cdf0e10cSrcweir    next i
506cdf0e10cSrcweir
507cdf0e10cSrcweir    findColumn() = -1
508cdf0e10cSrcweirEnd function
509cdf0e10cSrcweir</script:module>
510