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_ODBCMySQL.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 : ODBC MySQL Test
38 '\***********************************************************************
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 !"
47 ' **************************************************
48 ' databases specific settings for ODBC MySQL
49 ' **************************************************
51 Dim sFileName as string
52 sFileName = gOfficePath + Convertpath("user/work/TT_ODBC-MYSQL.odb")
54 Dim sTableName as string
55 sTableName = "tt_test_create-table"
63 dim sCatalog as string
64 sCatalog = " " ' not used in this ds
67 sSchema = " " ' not used in this ds
69 Dim aFieldTypeContent(30,2) as string 'database specific data matrix
71 aFieldTypeContent(1,1)="tt_bool"
72 aFieldTypeContent(1,2)="bool"
74 aFieldTypeContent(2,1)="tt_tinyint"
75 aFieldTypeContent(2,2)="tinyint"
77 aFieldTypeContent(3,1)="tt_bigint"
78 aFieldTypeContent(3,2)="bigint"
80 aFieldTypeContent(4,1)="tt_long_varbinary"
81 aFieldTypeContent(4,2)="long varbinary"
83 aFieldTypeContent(5,1)="tt_mediumblob"
84 aFieldTypeContent(5,2)="mediumblob"
86 aFieldTypeContent(6,1)="tt_longblob"
87 aFieldTypeContent(6,2)="longblob"
89 aFieldTypeContent(7,1)="tt_blob"
90 aFieldTypeContent(7,2)="blob"
92 aFieldTypeContent(8,1)="tt_tinyblob"
93 aFieldTypeContent(8,2)="tinyblob"
95 aFieldTypeContent(9,1)="tt_varbinary"
96 aFieldTypeContent(9,2)="varbinary"
98 aFieldTypeContent(10,1)="tt_binary"
99 aFieldTypeContent(10,2)="binary"
101 aFieldTypeContent(11,1)="tt_longvarchar"
102 aFieldTypeContent(11,2)="long varchar"
104 aFieldTypeContent(12,1)="tt_mediumtext"
105 aFieldTypeContent(12,2)="mediumtext"
107 aFieldTypeContent(13,1)="tt_longtext"
108 aFieldTypeContent(13,2)="longtext"
110 aFieldTypeContent(14,1)="tt_text"
111 aFieldTypeContent(14,2)="text"
113 aFieldTypeContent(15,1)="tt_tinytext"
114 aFieldTypeContent(15,2)="tinytext"
116 aFieldTypeContent(16,1)="tt_char"
117 aFieldTypeContent(16,2)="char"
119 aFieldTypeContent(17,1)="tt_numeric"
120 aFieldTypeContent(17,2)="numeric"
122 aFieldTypeContent(18,1)="tt_decimal"
123 aFieldTypeContent(18,2)="decimal"
125 aFieldTypeContent(19,1)="tt_integer"
126 aFieldTypeContent(19,2)="integer"
128 aFieldTypeContent(20,1)="tt_int"
129 aFieldTypeContent(20,2)="int"
131 aFieldTypeContent(21,1)="tt_mediumint"
132 aFieldTypeContent(21,2)="mediumint"
134 aFieldTypeContent(22,1)="tt_smallint"
135 aFieldTypeContent(22,2)="smallint"
137 aFieldTypeContent(23,1)="tt_float"
138 aFieldTypeContent(23,2)="float"
140 aFieldTypeContent(24,1)="tt_varchar"
141 aFieldTypeContent(24,2)="varchar"
143 aFieldTypeContent(25,1)="tt_date"
144 aFieldTypeContent(25,2)="date"
146 aFieldTypeContent(26,1)="tt_time"
147 aFieldTypeContent(26,2)="time"
149 aFieldTypeContent(27,1)="tt_datetime"
150 aFieldTypeContent(27,2)="datetime"
152 aFieldTypeContent(28,1)="tt_timestamp"
153 aFieldTypeContent(28,2)="timestamp"
155 aFieldTypeContent(29,1)="tt_bit"
156 aFieldTypeContent(29,2)="bit"
160 Dim aFieldContent(1,6) as string 'database specific data matrix
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"
172 dim aDatabaseProperties(5) as string
173 aDatabaseProperties() = tools_dbtools_fgetMySQLODBCDatabaseProperties()
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."
181 dbok = fCreateMySQL_ODBC_Datasource(sFileName,aDatabaseProperties(2),aDatabaseProperties(3))
185 call fOpendatabase(sFileName,aDatabaseProperties(4))
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")
194 warnlog "Data Source could not be created - beyond testcases stopped"