1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: db_ADOAccess.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 07:43:41 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : marc.neumann@sun.com
36 '* short description : Create ADO Access DS & Table & fill in Test
38 '\***********************************************************************
41 if gtSYSName = "Mac OS X" or gtSYSName = "Solaris SPARC" or gtSYSName = "Solaris x86" or gtSYSName = "Linux" then
42 printlog "This is an ADO test and works only on Windosen"
43 printlog "You have a: " + gtSYSName + " OS - Test Stopped !"
46 ' *********************************************************************
47 ' databases specific settings for ADO Access OLEDB 4.0 on Windosen
48 ' *********************************************************************
50 Dim i_fieldcount as integer 'amount of field types - columns
53 Dim ifieldrow_amount as integer 'amount of inserted rows
56 Dim sFileName as string
57 sFileName = gOfficePath + ConvertPath("user/work/TT_Ado_Access.odb")
60 sDBURL = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
62 Dim sTableName as string
63 sTableName = "tt_test_create-table"
68 dim sCatalog as string
69 sCatalog = " " ' not used in this ds
72 sSchema = " " ' not used in this ds
74 dim sRelTable1 as string 'for relation test (tRelation1&2)
75 sRelTable1 = "TT_Rel1"
77 dim sRelTable2 as string 'for relation test (tRelation1&2)
78 sRelTable2 = "TT_Rel2"
80 dim sRelTable3 as string 'for relation test (tRelation2)
81 sRelTable3 = "TT_Rel3"
84 Dim aFields(i_fieldcount,2) as string
86 aFields(1,1)="tt_bit" 'name of fieldtype
87 aFields(1,2)="bit" 'number of fieldtype (listbox entry)
89 aFields(2,1)="tt_byte"
92 aFields(3,1)="tt_guid"
95 aFields(4,1)="tt_bigbinary"
96 aFields(4,2)="bigbinary"
98 aFields(5,1)="tt_longbinary"
99 aFields(5,2)="longbinary"
101 aFields(6,1)="tt_varbinary"
102 aFields(6,2)="varbinary"
104 'SQL Null [ ] is a foult in metadata of driver bug: #108535 in OLEDB 4.0 (number without field -> field does not exist)
106 aFields(7,1)="tt_decimal" ' bug #108512 - should work after that
107 aFields(7,2)="decimal"
109 aFields(8,1)="tt_long"
112 aFields(9,1)="tt_short"
115 aFields(10,1)="tt_single"
116 aFields(10,2)="single"
118 aFields(11,1)="tt_double"
119 aFields(11,2)="double"
121 aFields(12,1)="tt_currency"
122 aFields(12,2)="currency"
124 aFields(13,1)="tt_longtext"
125 aFields(13,2)="longtext"
127 aFields(14,1)="tt_varchar"
128 aFields(14,2)="varchar"
130 aFields(15,1)="tt_datetime"
131 aFields(15,2)="datetime"
134 Dim aFieldsContent(1,16) as string
136 aFieldsContent(1,1)="1"
137 aFieldsContent(1,2)="<space>"
138 aFieldsContent(1,3)="1"
139 aFieldsContent(1,4)="1"
140 aFieldsContent(1,5)=""
141 aFieldsContent(1,6)=""
142 aFieldsContent(1,7)=""
143 aFieldsContent(1,8)=""
144 aFieldsContent(1,9)="1"
145 aFieldsContent(1,10)="1"
146 aFieldsContent(1,11)="1"
147 aFieldsContent(1,12)="1"
148 aFieldsContent(1,13)="1"
149 aFieldsContent(1,14)="1"
150 aFieldsContent(1,15)="1"
151 aFieldsContent(1,16)="1"
156 ' restart the office to unlock the mdb file. Remember the Quickstarter
157 printlog "tart the office to unlock the mdb file. Remember the Quickstarter"
160 app.FileCopy gTesttoolPath + ConvertPath("dbaccess/optional/input/ado_datasource/testdb.mdb"),gOfficePath + ConvertPath("user/work/testdb.mdb")
161 dbok = fCreateADODatasource( sFileName, sDBURL + gOfficePath + ConvertPath("user/work/testdb.mdb"))
164 call fOpendatabase(sFileName)
165 call fCreateTable(aFields(),sTableName)
166 call fInsertIntoTable( aFieldsContent(), sTableName)
167 call fDeleteTable(sTableName)
170 call tRelation( sFileName, sPWD, sRelTable1, sRelTable2 )
171 call tDoubleRelation( sFileName, sPWD, sRelTable1, sRelTable2, sRelTable3 )
173 call db_Query(sFileName)
176 warnlog "Data Source could not be created - beyond testcases stopped"