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_JDBCMySQL.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 JDBC MySQL DS & Table & fill in Test
38 '\***********************************************************************
41 ' **************************************************
42 ' databases specific settings for JDBC MySQL
43 ' **************************************************
45 qaerrorlog "due to issue 98387 this test will not work anymore."
48 Dim sFileName as string
49 sFileName = gOfficePath + Convertpath("user/work/TT_JDBC-MYSQL.odb")
51 Dim sTableName as string
52 sTableName = "tt_test_create-table"
60 dim sCatalog as string
61 sCatalog = " " ' not used in this ds
64 sSchema = " " ' not used in this ds
66 Dim aFieldTypeContent(30,2) as string 'database specific data matrix
68 aFieldTypeContent(1,1)="tt_bool"
69 aFieldTypeContent(1,2)="bool"
71 aFieldTypeContent(2,1)="tt_tinyint"
72 aFieldTypeContent(2,2)="tinyint"
74 aFieldTypeContent(3,1)="tt_bigint"
75 aFieldTypeContent(3,2)="bigint"
77 aFieldTypeContent(4,1)="tt_long_varbinary"
78 aFieldTypeContent(4,2)="long varbinary"
80 aFieldTypeContent(5,1)="tt_mediumblob"
81 aFieldTypeContent(5,2)="mediumblob"
83 aFieldTypeContent(6,1)="tt_longblob"
84 aFieldTypeContent(6,2)="longblob"
86 aFieldTypeContent(7,1)="tt_blob"
87 aFieldTypeContent(7,2)="blob"
89 aFieldTypeContent(8,1)="tt_tinyblob"
90 aFieldTypeContent(8,2)="tinyblob"
92 aFieldTypeContent(9,1)="tt_varbinary"
93 aFieldTypeContent(9,2)="varbinary"
95 aFieldTypeContent(10,1)="tt_binary"
96 aFieldTypeContent(10,2)="binary"
98 aFieldTypeContent(11,1)="tt_longvarchar"
99 aFieldTypeContent(11,2)="long varchar"
101 aFieldTypeContent(12,1)="tt_mediumtext"
102 aFieldTypeContent(12,2)="mediumtext"
104 aFieldTypeContent(13,1)="tt_longtext"
105 aFieldTypeContent(13,2)="longtext"
107 aFieldTypeContent(14,1)="tt_text"
108 aFieldTypeContent(14,2)="text"
110 aFieldTypeContent(15,1)="tt_tinytext"
111 aFieldTypeContent(15,2)="tinytext"
113 aFieldTypeContent(16,1)="tt_char"
114 aFieldTypeContent(16,2)="char"
116 aFieldTypeContent(17,1)="tt_numeric"
117 aFieldTypeContent(17,2)="numeric"
119 aFieldTypeContent(18,1)="tt_decimal"
120 aFieldTypeContent(18,2)="decimal"
122 aFieldTypeContent(19,1)="tt_integer"
123 aFieldTypeContent(19,2)="integer"
125 aFieldTypeContent(20,1)="tt_int"
126 aFieldTypeContent(20,2)="int"
128 aFieldTypeContent(21,1)="tt_mediumint"
129 aFieldTypeContent(21,2)="mediumint"
131 aFieldTypeContent(22,1)="tt_smallint"
132 aFieldTypeContent(22,2)="smallint"
134 aFieldTypeContent(23,1)="tt_float"
135 aFieldTypeContent(23,2)="float"
137 aFieldTypeContent(24,1)="tt_varchar"
138 aFieldTypeContent(24,2)="varchar"
140 aFieldTypeContent(25,1)="tt_date"
141 aFieldTypeContent(25,2)="date"
143 aFieldTypeContent(26,1)="tt_time"
144 aFieldTypeContent(26,2)="time"
146 aFieldTypeContent(27,1)="tt_datetime"
147 aFieldTypeContent(27,2)="datetime"
149 aFieldTypeContent(28,1)="tt_timestamp"
150 aFieldTypeContent(28,2)="timestamp"
152 aFieldTypeContent(29,1)="tt_bit"
153 aFieldTypeContent(29,2)="bit"
157 Dim aFieldContent(1,6) as string 'database specific data matrix
159 aFieldContent(1,1)="1"
160 aFieldContent(1,2)="<space>"
161 aFieldContent(1,3)="1"
162 aFieldContent(1,4)="1"
163 aFieldContent(1,5)="1"
164 aFieldContent(1,6)="1"
166 call fSetJDBCDriverFiles(gTesttoolPath + Convertpath("dbaccess/optional/input/driver/mysql_jconnector.jar"))
167 'after changing the classpath the office has to be restarted.
168 call ExitRestartTheOffice
173 dim aDatabaseProperties(5) as string
174 aDatabaseProperties() = tools_dbtools_fgetMySQLJDBCDatabaseProperties()
176 ' if and only if no properties are defined in the environment file the test is stopped
177 if(aDatabaseProperties(1) = "no") then
178 qaerrorlog "No database properties from Mysql defiened. The Test is stopped here."
182 dbok = fCreateMySQL_JDBC_Datasource(sFileName,aDatabaseProperties(3),aDatabaseProperties(2),aDatabaseProperties(4),aDatabaseProperties(5))
185 call fOpendatabase(sFileName,aDatabaseProperties(6))
186 call fCreateTable( aFieldTypeContent(), sTableName)
187 call fInsertIntoTable( aFieldContent(), sTableName)
190 'use "dbaccess/optional/includes/b_lvl1_Query.inc"
191 'call b_lvl1_Query(sFileName,"dbase")
193 call tRelation( sFileName, aDatabaseProperties(6), "rel1", "rel2" )
196 warnlog "Data Source could not be created - beyond testcases stopped"