merge the formfield patch from ooo-build
[ooovba.git] / testautomation / dbaccess / optional / includes / db_ODBCMySQL.inc
blobfca936566e3d7a2564daad4263556a4176223cfe
1 'encoding UTF-8  Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 '* 
5 '* Copyright 2008 by Sun Microsystems, Inc.
6 '*
7 '* OpenOffice.org - a multi-platform office productivity suite
8 '*
9 '* $RCSfile: db_ODBCMySQL.inc,v $
11 '* $Revision: 1.1 $
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 : ODBC MySQL Test
38 '\***********************************************************************
40 testcase db_ODBCMySQL
41     
42     if gtSYSName = "MAC" or gtSYSName = "Solaris SPARC" or gtSYSName = "Solaris x86" then
43         printlog "This test does work only under linux and windows yet."
44         printlog "You have a: " + gtSYSName + " OS - Test Stopped !"
45         else                
46         
47         ' **************************************************
48         '   databases specific settings for ODBC MySQL
49         ' **************************************************
50         
51         Dim sFileName as string 
52         sFileName = gOfficePath + Convertpath("user/work/TT_ODBC-MYSQL.odb")
53             
54         Dim sTableName as string
55         sTableName = "tt_test_create-table"    
56         
57         Dim sUser as string
58         sUser = "testtool"
59         
60         Dim sPWD as string
61         sPWD = "testtool"
62         
63         dim sCatalog as string
64         sCatalog = " "                          ' not used in this ds
65         
66         dim sSchema as string
67         sSchema = " "                           ' not used in this ds
68         
69         Dim aFieldTypeContent(30,2) as string 'database specific data matrix
70             
71         aFieldTypeContent(1,1)="tt_bool"
72         aFieldTypeContent(1,2)="bool"
73             
74         aFieldTypeContent(2,1)="tt_tinyint"
75         aFieldTypeContent(2,2)="tinyint"
76              
77         aFieldTypeContent(3,1)="tt_bigint"
78         aFieldTypeContent(3,2)="bigint"
79          
80         aFieldTypeContent(4,1)="tt_long_varbinary"
81         aFieldTypeContent(4,2)="long varbinary"
82             
83         aFieldTypeContent(5,1)="tt_mediumblob"
84         aFieldTypeContent(5,2)="mediumblob"
85              
86         aFieldTypeContent(6,1)="tt_longblob"
87         aFieldTypeContent(6,2)="longblob"
88             
89         aFieldTypeContent(7,1)="tt_blob"
90         aFieldTypeContent(7,2)="blob"
91             
92         aFieldTypeContent(8,1)="tt_tinyblob"
93         aFieldTypeContent(8,2)="tinyblob"
94             
95         aFieldTypeContent(9,1)="tt_varbinary"
96         aFieldTypeContent(9,2)="varbinary"
97             
98         aFieldTypeContent(10,1)="tt_binary"
99         aFieldTypeContent(10,2)="binary"
100             
101         aFieldTypeContent(11,1)="tt_longvarchar"
102         aFieldTypeContent(11,2)="long varchar"
103             
104         aFieldTypeContent(12,1)="tt_mediumtext"
105         aFieldTypeContent(12,2)="mediumtext"
106             
107         aFieldTypeContent(13,1)="tt_longtext"
108         aFieldTypeContent(13,2)="longtext"
109             
110         aFieldTypeContent(14,1)="tt_text"
111         aFieldTypeContent(14,2)="text"
112             
113         aFieldTypeContent(15,1)="tt_tinytext"
114         aFieldTypeContent(15,2)="tinytext"
115             
116         aFieldTypeContent(16,1)="tt_char"
117         aFieldTypeContent(16,2)="char"
118             
119         aFieldTypeContent(17,1)="tt_numeric"
120         aFieldTypeContent(17,2)="numeric"
121             
122         aFieldTypeContent(18,1)="tt_decimal"
123         aFieldTypeContent(18,2)="decimal"
124             
125         aFieldTypeContent(19,1)="tt_integer"
126         aFieldTypeContent(19,2)="integer"
127             
128         aFieldTypeContent(20,1)="tt_int"
129         aFieldTypeContent(20,2)="int"
130             
131         aFieldTypeContent(21,1)="tt_mediumint"
132         aFieldTypeContent(21,2)="mediumint"
133             
134         aFieldTypeContent(22,1)="tt_smallint"
135         aFieldTypeContent(22,2)="smallint"
136            
137         aFieldTypeContent(23,1)="tt_float"
138         aFieldTypeContent(23,2)="float"
139         
140         aFieldTypeContent(24,1)="tt_varchar"    
141         aFieldTypeContent(24,2)="varchar"
142          
143         aFieldTypeContent(25,1)="tt_date"       
144         aFieldTypeContent(25,2)="date"
145          
146         aFieldTypeContent(26,1)="tt_time"       
147         aFieldTypeContent(26,2)="time"
148         
149         aFieldTypeContent(27,1)="tt_datetime"   
150         aFieldTypeContent(27,2)="datetime"
151         
152         aFieldTypeContent(28,1)="tt_timestamp"  
153         aFieldTypeContent(28,2)="timestamp"
154         
155         aFieldTypeContent(29,1)="tt_bit"
156         aFieldTypeContent(29,2)="bit"
157     
158         
159         
160         Dim aFieldContent(1,6) as string 'database specific data matrix
161             
162         aFieldContent(1,1)="1"
163         aFieldContent(1,2)="<space>"    
164         aFieldContent(1,3)="1"                  
165         aFieldContent(1,4)="1"          
166         aFieldContent(1,5)="1"
167         aFieldContent(1,6)="1"
168             
169         dim dbok as boolean
170         dbok = false
171         
172         dim aDatabaseProperties(5) as string
173         aDatabaseProperties() = tools_dbtools_fgetMySQLODBCDatabaseProperties()
174         
175         ' if and only if no properties are defined in the environment file the test is stopped
176         if(aDatabaseProperties(1) = "no") then
177             qaerrorlog "No database properties from Mysql defiened. The Test is stopped here."
178             goto endsub
179         endif
180         
181         dbok = fCreateMySQL_ODBC_Datasource(sFileName,aDatabaseProperties(2),aDatabaseProperties(3))        
182         
183         if dbok = true then
184         
185             call fOpendatabase(sFileName,aDatabaseProperties(4))
186             call fCreateTable( aFieldTypeContent(), sTableName)
187             call fInsertIntoTable( aFieldContent(), sTableName)
188             call fCloseDatabase    
189             
190             'use "dbaccess/optional/includes/b_lvl1_Query.inc"
191             'call b_lvl1_Query(sFileName,"dbase")
192             
193         else 
194             warnlog "Data Source could not be created - beyond testcases stopped"
195         endif
196         endif
197 endcase