1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="sdbc_XDriver" script:language="StarBasic">
4
5
6'*************************************************************************
7'
8' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9'
10' Copyright 2000, 2010 Oracle and/or its affiliates.
11'
12' OpenOffice.org - a multi-platform office productivity suite
13'
14' This file is part of OpenOffice.org.
15'
16' OpenOffice.org is free software: you can redistribute it and/or modify
17' it under the terms of the GNU Lesser General Public License version 3
18' only, as published by the Free Software Foundation.
19'
20' OpenOffice.org is distributed in the hope that it will be useful,
21' but WITHOUT ANY WARRANTY; without even the implied warranty of
22' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23' GNU Lesser General Public License version 3 for more details
24' (a copy is included in the LICENSE file that accompanied this code).
25'
26' You should have received a copy of the GNU Lesser General Public License
27' version 3 along with OpenOffice.org.  If not, see
28' <http://www.openoffice.org/license.html>
29' for a copy of the LGPLv3 License.
30'
31'*************************************************************************
32*****
33'*************************************************************************
34
35
36
37' Be sure that all variables are dimensioned:
38option explicit
39
40'*************************************************************************
41' This Interface/Service test depends on the following GLOBAL variables,
42' which must be specified in the object creation:
43
44'     - Global URL as String
45'       Global info As Variant
46
47'*************************************************************************
48
49
50
51
52
53Sub RunTest()
54
55'*************************************************************************
56' INTERFACE:
57' com.sun.star.sdbc.XDriver
58'*************************************************************************
59On Error Goto ErrHndl
60    Dim bOK As Boolean
61
62    Test.StartMethod("acceptsURL()")
63    bOK = oObj.acceptsURL(URL)
64    Out.log("acceptsURL('" + URL + "')? " + bOK)
65    Test.MethodTested("acceptsURL()", bOK)
66
67    Test.StartMethod("connect()")
68    Out.log("connecting to '" + URL + "'")
69    Dim connection As Object
70    connection = oObj.connect(URL, info)
71    bOK = Not IsNull(connection)
72    Test.MethodTested("connect()", bOK)
73
74    Test.StartMethod("getPropertyInfo()")
75    Dim dpi As Variant
76    dpi = oObj.getPropertyInfo(URL, info)
77    bOK = Not IsNull(dpi)
78    if bOK then
79        Dim i As Integer
80        for i = 0 to ubound(dpi)
81            Out.log(dpi(i).Name + ": " + dpi(i).Value)
82        next i
83    endif
84    Test.MethodTested("getPropertyInfo()", bOK)
85
86    Test.StartMethod("getMajorVersion()")
87    bOK = true
88    Dim majVer As Integer
89    majVer = oObj.getMajorVersion()
90    Out.log("Major version: " + majVer)
91    Test.MethodTested("getMajorVersion()", bOK)
92
93    Test.StartMethod("getMinorVersion()")
94    bOK = true
95    Dim minVer As Integer
96    minVer = oObj.getMinorVersion()
97    Out.log("Minor version: " + minVer)
98    Test.MethodTested("getMinorVersion()", bOK)
99Exit Sub
100ErrHndl:
101    Test.Exception()
102    bOK = false
103    resume next
104End Sub
105</script:module>
106