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_Dbase.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 dBase DS & Table & fill in Test
38 '\***********************************************************************
41 ' *********************************************************************
42 ' databases specific settings for dBase
43 ' *********************************************************************
45 Dim i_fieldcount as integer 'amount of field types - columns
46 i_fieldcount = 7 'amount of field types (no primary key supported in dBase) normally: 7
48 Dim ifieldrow_amount as integer 'amount of inserted rows
51 Dim sFileName as string
52 sFileName = gOfficePath + ConvertPath("user/work/tt_dbase-01.odb")
57 Dim sTableName as string
58 sTableName = "tt_test_create-table"
63 Dim sCatalog as string
64 sCatalog = " " ' not used in this ds
67 sSchema = " " ' not used in this ds
70 Dim aFieldTypeContent(i_fieldcount,2) as string 'database specific data matrix
72 aFieldTypeContent(1,1)="tt_boolean" 'name of fieldtype
73 aFieldTypeContent(1,2)="boolean" 'number of fieldtype (listbox entry)
75 aFieldTypeContent(2,1)="tt_longvar"
76 aFieldTypeContent(2,2)="longvarchar"
78 aFieldTypeContent(3,1)="tt_char"
79 aFieldTypeContent(3,2)="char"
81 aFieldTypeContent(4,1)="tt_decimal"
82 aFieldTypeContent(4,2)="decimal"
84 aFieldTypeContent(5,1)="tt_varchar"
85 aFieldTypeContent(5,2)="varchar"
87 aFieldTypeContent(6,1)="tt_date"
88 aFieldTypeContent(6,2)="date"
90 Dim aFieldContent(1,6) as string 'database specific data matrix
92 aFieldContent(1,1)="<space>"
93 aFieldContent(1,2)="this is a memo field"
94 aFieldContent(1,3)="char"
95 aFieldContent(1,4)="1"
96 aFieldContent(1,5)="this is a text field"
97 aFieldContent(1,6)="13.05.2004 "
100 dbok = fCreateDbaseDatasource(sFileName,gOfficePath + ConvertPath("user/work"),"TT_dBase")
103 'needed for: tQuery testcase - query file is copied in the work directory
104 ' the files need to be copy before the datasource is open
105 app.FileCopy gTesttoolPath + ConvertPath("dbaccess/optional/input/dbase_datasource/TT_Forms.dbf"),gOfficePath + ConvertPath("user/work/TT_Forms.dbf")
106 app.FileCopy gTesttoolPath + ConvertPath("dbaccess/optional/input/dbase_datasource/TT_Query1.dbf"),gOfficePath + ConvertPath("user/work/TT_Query1.dbf")
107 app.FileCopy gTesttoolPath + ConvertPath("dbaccess/optional/input/dbase_datasource/TT_Query1.dbt"),gOfficePath + ConvertPath("user/work/TT_Query1.dbt")
109 call fOpendatabase(sFileName)
110 call fCreateTable( aFieldTypeContent(), sTableName)
111 call fInsertIntoTable( aFieldContent(), sTableName)
114 call db_Query(sFileName,"dbase")
116 use "dbaccess/optional/includes/db_IndexDesign.inc"
117 call tIndex(sFileName, sTableName)
120 warnlog "Data Source could not be created - beyond testcases stopped"