1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?> 2*b1cdbd2cSJim Jagielski<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3*b1cdbd2cSJim Jagielski<!--*********************************************************** 4*b1cdbd2cSJim Jagielski * 5*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 6*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 7*b1cdbd2cSJim Jagielski * distributed with this work for additional information 8*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 9*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 10*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 11*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 14*b1cdbd2cSJim Jagielski * 15*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 16*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 17*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 19*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 20*b1cdbd2cSJim Jagielski * under the License. 21*b1cdbd2cSJim Jagielski * 22*b1cdbd2cSJim Jagielski ***********************************************************--> 23*b1cdbd2cSJim Jagielski<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DBMeta" script:language="StarBasic">REM ***** BASIC ***** 24*b1cdbd2cSJim JagielskiOption Explicit 25*b1cdbd2cSJim Jagielski 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim JagielskiPublic iCommandTypes() as Integer 28*b1cdbd2cSJim JagielskiPublic CurCommandType as Integer 29*b1cdbd2cSJim JagielskiPublic oDataSource as Object 30*b1cdbd2cSJim JagielskiPublic bEnableBinaryOptionGroup as Boolean 31*b1cdbd2cSJim Jagielski'Public bSelectContent as Boolean 32*b1cdbd2cSJim Jagielski 33*b1cdbd2cSJim Jagielski 34*b1cdbd2cSJim JagielskiFunction GetDatabaseNames(baddFirstListItem as Boolean) 35*b1cdbd2cSJim JagielskiDim sDatabaseList() 36*b1cdbd2cSJim Jagielski If oDBContext.HasElements Then 37*b1cdbd2cSJim Jagielski Dim LocDBList() as String 38*b1cdbd2cSJim Jagielski Dim MaxIndex as Integer 39*b1cdbd2cSJim Jagielski Dim i as Integer 40*b1cdbd2cSJim Jagielski LocDBList = oDBContext.ElementNames() 41*b1cdbd2cSJim Jagielski MaxIndex = Ubound(LocDBList()) 42*b1cdbd2cSJim Jagielski If baddfirstListItem Then 43*b1cdbd2cSJim Jagielski ReDim Preserve sDatabaseList(MaxIndex + 1) 44*b1cdbd2cSJim Jagielski sDatabaseList(0) = sSelectDatasource 45*b1cdbd2cSJim Jagielski a = 1 46*b1cdbd2cSJim Jagielski Else 47*b1cdbd2cSJim Jagielski ReDim Preserve sDatabaseList(MaxIndex) 48*b1cdbd2cSJim Jagielski a = 0 49*b1cdbd2cSJim Jagielski End If 50*b1cdbd2cSJim Jagielski For i = 0 To MaxIndex 51*b1cdbd2cSJim Jagielski sDatabaseList(a) = oDBContext.ElementNames(i) 52*b1cdbd2cSJim Jagielski a = a + 1 53*b1cdbd2cSJim Jagielski Next i 54*b1cdbd2cSJim Jagielski End If 55*b1cdbd2cSJim Jagielski GetDatabaseNames() = sDatabaseList() 56*b1cdbd2cSJim JagielskiEnd Function 57*b1cdbd2cSJim Jagielski 58*b1cdbd2cSJim Jagielski 59*b1cdbd2cSJim JagielskiSub GetSelectedDBMetaData(sDBName as String) 60*b1cdbd2cSJim JagielskiDim OldsDBname as String 61*b1cdbd2cSJim JagielskiDim DBIndex as Integer 62*b1cdbd2cSJim JagielskiDim LocList() as String 63*b1cdbd2cSJim Jagielski' If bStartUp Then 64*b1cdbd2cSJim Jagielski' bStartUp = false 65*b1cdbd2cSJim Jagielski' Exit Sub 66*b1cdbd2cSJim Jagielski' End Sub 67*b1cdbd2cSJim Jagielski ToggleDatabasePage(False) 68*b1cdbd2cSJim Jagielski With DialogModel 69*b1cdbd2cSJim Jagielski If GetConnection(sDBName) Then 70*b1cdbd2cSJim Jagielski If GetDBMetaData() Then 71*b1cdbd2cSJim Jagielski LocList() = AddListToList(Array(sSelectDBTable), TableNames()) 72*b1cdbd2cSJim Jagielski .lstTables.StringItemList() = AddListToList(LocList(), QueryNames()) 73*b1cdbd2cSJim Jagielski' bSelectContent = True 74*b1cdbd2cSJim Jagielski .lstTables.SelectedItems() = Array(0) 75*b1cdbd2cSJim Jagielski iCommandTypes() = CreateCommandTypeList() 76*b1cdbd2cSJim Jagielski EmptyFieldsListboxes() 77*b1cdbd2cSJim Jagielski End If 78*b1cdbd2cSJim Jagielski End If 79*b1cdbd2cSJim Jagielski bEnableBinaryOptionGroup = False 80*b1cdbd2cSJim Jagielski .lstTables.Enabled = True 81*b1cdbd2cSJim Jagielski .lblTables.Enabled = True 82*b1cdbd2cSJim Jagielski' Else 83*b1cdbd2cSJim Jagielski' DialogModel.lstTables.StringItemList = Array(sSelectDBTable) 84*b1cdbd2cSJim Jagielski' EmptyFieldsListboxes() 85*b1cdbd2cSJim Jagielski' End If 86*b1cdbd2cSJim Jagielski ToggleDatabasePage(True) 87*b1cdbd2cSJim Jagielski End With 88*b1cdbd2cSJim JagielskiEnd Sub 89*b1cdbd2cSJim Jagielski 90*b1cdbd2cSJim Jagielski 91*b1cdbd2cSJim JagielskiFunction GetConnection(sDBName as String) 92*b1cdbd2cSJim JagielskiDim oInteractionHandler as Object 93*b1cdbd2cSJim JagielskiDim bExitLoop as Boolean 94*b1cdbd2cSJim JagielskiDim bGetConnection as Boolean 95*b1cdbd2cSJim JagielskiDim iMsg as Integer 96*b1cdbd2cSJim JagielskiDim Nulllist() 97*b1cdbd2cSJim Jagielski If Not IsNull(oDBConnection) Then 98*b1cdbd2cSJim Jagielski oDBConnection.Dispose() 99*b1cdbd2cSJim Jagielski End If 100*b1cdbd2cSJim Jagielski oDataSource = oDBContext.GetByName(sDBName) 101*b1cdbd2cSJim Jagielski' If Not oDBContext.hasbyName(sDBName) Then 102*b1cdbd2cSJim Jagielski' GetConnection() = False 103*b1cdbd2cSJim Jagielski' Exit Function 104*b1cdbd2cSJim Jagielski' End If 105*b1cdbd2cSJim Jagielski If Not oDataSource.IsPasswordRequired Then 106*b1cdbd2cSJim Jagielski oDBConnection = oDBContext.GetByName(sDBName).GetConnection("","") 107*b1cdbd2cSJim Jagielski GetConnection() = True 108*b1cdbd2cSJim Jagielski Else 109*b1cdbd2cSJim Jagielski oInteractionHandler = createUnoService("com.sun.star.task.InteractionHandler") 110*b1cdbd2cSJim Jagielski oDataSource = oDBContext.GetByName(sDBName) 111*b1cdbd2cSJim Jagielski On Local Error Goto NOCONNECTION 112*b1cdbd2cSJim Jagielski Do 113*b1cdbd2cSJim Jagielski bExitLoop = True 114*b1cdbd2cSJim Jagielski oDBConnection = oDataSource.ConnectWithCompletion(oInteractionHandler) 115*b1cdbd2cSJim Jagielski NOCONNECTION: 116*b1cdbd2cSJim Jagielski bGetConnection = Err = 0 117*b1cdbd2cSJim Jagielski If bGetConnection Then 118*b1cdbd2cSJim Jagielski bGetConnection = Not IsNull(oDBConnection) 119*b1cdbd2cSJim Jagielski If Not bGetConnection Then 120*b1cdbd2cSJim Jagielski Exit Do 121*b1cdbd2cSJim Jagielski End If 122*b1cdbd2cSJim Jagielski End If 123*b1cdbd2cSJim Jagielski If Not bGetConnection Then 124*b1cdbd2cSJim Jagielski iMsg = Msgbox (sMsgNoConnection,32 + 2, sMsgWizardName) 125*b1cdbd2cSJim Jagielski bExitLoop = iMsg = SBCANCEL 126*b1cdbd2cSJim Jagielski Resume CLERROR 127*b1cdbd2cSJim Jagielski CLERROR: 128*b1cdbd2cSJim Jagielski End If 129*b1cdbd2cSJim Jagielski Loop Until bExitLoop 130*b1cdbd2cSJim Jagielski On Local Error Goto 0 131*b1cdbd2cSJim Jagielski If Not bGetConnection Then 132*b1cdbd2cSJim Jagielski DialogModel.lstTables.StringItemList() = Array(sSelectDBTable) 133*b1cdbd2cSJim Jagielski DialogModel.lstFields.StringItemList() = NullList() 134*b1cdbd2cSJim Jagielski DialogModel.lstSelFields.StringItemList() = NullList() 135*b1cdbd2cSJim Jagielski End If 136*b1cdbd2cSJim Jagielski GetConnection() = bGetConnection 137*b1cdbd2cSJim Jagielski End If 138*b1cdbd2cSJim JagielskiEnd Function 139*b1cdbd2cSJim Jagielski 140*b1cdbd2cSJim Jagielski 141*b1cdbd2cSJim JagielskiFunction GetDBMetaData() 142*b1cdbd2cSJim Jagielski If oDBContext.HasElements Then 143*b1cdbd2cSJim Jagielski Tablenames() = oDBConnection.Tables.ElementNames() 144*b1cdbd2cSJim Jagielski Querynames() = oDBConnection.Queries.ElementNames() 145*b1cdbd2cSJim Jagielski GetDBMetaData = True 146*b1cdbd2cSJim Jagielski Else 147*b1cdbd2cSJim Jagielski MsgBox(sMsgErrNoDatabase, 64, sMsgWizardName) 148*b1cdbd2cSJim Jagielski GetDBMetaData = False 149*b1cdbd2cSJim Jagielski End If 150*b1cdbd2cSJim JagielskiEnd Function 151*b1cdbd2cSJim Jagielski 152*b1cdbd2cSJim Jagielski 153*b1cdbd2cSJim JagielskiSub GetTableMetaData() 154*b1cdbd2cSJim JagielskiDim iType as Long 155*b1cdbd2cSJim JagielskiDim m as Integer 156*b1cdbd2cSJim JagielskiDim Found as Boolean 157*b1cdbd2cSJim JagielskiDim i as Integer 158*b1cdbd2cSJim JagielskiDim sFieldName as String 159*b1cdbd2cSJim JagielskiDim n as Integer 160*b1cdbd2cSJim JagielskiDim WidthIndex as Integer 161*b1cdbd2cSJim JagielskiDim oField as Object 162*b1cdbd2cSJim Jagielski MaxIndex = Ubound(DialogModel.lstSelFields.StringItemList()) 163*b1cdbd2cSJim Jagielski Dim ColumnMap(MaxIndex)as Integer 164*b1cdbd2cSJim Jagielski FieldNames() = DialogModel.lstSelFields.StringItemList() 165*b1cdbd2cSJim Jagielski ' Build a structure which maps the position of a selected field (within the selection) to the the column position within 166*b1cdbd2cSJim Jagielski ' the table. So we ensure that the controls are placed in the same order the according fields are selected. 167*b1cdbd2cSJim Jagielski For i = 0 To Ubound(FieldNames()) 168*b1cdbd2cSJim Jagielski sFieldName = FieldNames(i) 169*b1cdbd2cSJim Jagielski Found = False 170*b1cdbd2cSJim Jagielski n = 0 171*b1cdbd2cSJim Jagielski While (n< MaxIndex And (Not Found)) 172*b1cdbd2cSJim Jagielski If (FieldNames(n) = sFieldName) Then 173*b1cdbd2cSJim Jagielski Found = True 174*b1cdbd2cSJim Jagielski ColumnMap(n) = i 175*b1cdbd2cSJim Jagielski End If 176*b1cdbd2cSJim Jagielski n = n + 1 177*b1cdbd2cSJim Jagielski Wend 178*b1cdbd2cSJim Jagielski Next i 179*b1cdbd2cSJim Jagielski For n = 0 to MaxIndex 180*b1cdbd2cSJim Jagielski sFieldname = FieldNames(n) 181*b1cdbd2cSJim Jagielski oField = oColumns.GetByName(sFieldName) 182*b1cdbd2cSJim Jagielski iType = oField.Type 183*b1cdbd2cSJim Jagielski FieldMetaValues(n,0) = oField.Type 184*b1cdbd2cSJim Jagielski FieldMetaValues(n,1) = AssignFieldLength(oField.Precision) 185*b1cdbd2cSJim Jagielski FieldMetaValues(n,2) = GetValueoutofList(iType, WidthList(),1, WidthIndex) 186*b1cdbd2cSJim Jagielski FieldMetaValues(n,3) = WidthList(WidthIndex,3) 187*b1cdbd2cSJim Jagielski FieldMetaValues(n,4) = oField.FormatKey 188*b1cdbd2cSJim Jagielski FieldMetaValues(n,5) = oField.DefaultValue 189*b1cdbd2cSJim Jagielski FieldMetaValues(n,6) = oField.IsCurrency 190*b1cdbd2cSJim Jagielski FieldMetaValues(n,7) = oField.Scale 191*b1cdbd2cSJim Jagielski' If oField.Description <> "" Then 192*b1cdbd2cSJim Jagielski'' Todo: What's wrong with this line? 193*b1cdbd2cSJim Jagielski' Msgbox oField.Helptext 194*b1cdbd2cSJim Jagielski' End If 195*b1cdbd2cSJim Jagielski FieldMetaValues(n,8) = oField.Description 196*b1cdbd2cSJim Jagielski Next 197*b1cdbd2cSJim Jagielski ReDim oDBShapeList(MaxIndex) as Object 198*b1cdbd2cSJim Jagielski ReDim oTCShapeList(MaxIndex) as Object 199*b1cdbd2cSJim Jagielski ReDim oDBModelList(MaxIndex) as Object 200*b1cdbd2cSJim Jagielski ReDim oGroupShapeList(MaxIndex) as Object 201*b1cdbd2cSJim JagielskiEnd Sub 202*b1cdbd2cSJim Jagielski 203*b1cdbd2cSJim Jagielski 204*b1cdbd2cSJim JagielskiFunction GetSpecificFieldNames() as Integer 205*b1cdbd2cSJim JagielskiDim n as Integer 206*b1cdbd2cSJim JagielskiDim m as Integer 207*b1cdbd2cSJim JagielskiDim s as Integer 208*b1cdbd2cSJim JagielskiDim iType as Integer 209*b1cdbd2cSJim JagielskiDim oField as Object 210*b1cdbd2cSJim JagielskiDim MaxIndex as Integer 211*b1cdbd2cSJim JagielskiDim EmptyList() 212*b1cdbd2cSJim Jagielski If Ubound(DialogModel.lstTables.StringItemList()) > -1 Then 213*b1cdbd2cSJim Jagielski FieldNames() = oColumns.GetElementNames() 214*b1cdbd2cSJim Jagielski MaxIndex = Ubound(FieldNames()) 215*b1cdbd2cSJim Jagielski If MaxIndex <> -1 Then 216*b1cdbd2cSJim Jagielski Dim ResultFieldNames(MaxIndex) 217*b1cdbd2cSJim Jagielski ReDim ImgFieldNames(MaxIndex) 218*b1cdbd2cSJim Jagielski m = 0 219*b1cdbd2cSJim Jagielski For n = 0 To MaxIndex 220*b1cdbd2cSJim Jagielski oField = oColumns.GetByName(FieldNames(n)) 221*b1cdbd2cSJim Jagielski iType = oField.Type 222*b1cdbd2cSJim Jagielski If GetIndexInMultiArray(WidthList(), iType, 0) <> -1 Then 223*b1cdbd2cSJim Jagielski ResultFieldNames(m) = FieldNames(n) 224*b1cdbd2cSJim Jagielski m = m + 1 225*b1cdbd2cSJim Jagielski End If 226*b1cdbd2cSJim Jagielski If GetIndexInMultiArray(ImgWidthList(), iType, 0) <> -1 Then 227*b1cdbd2cSJim Jagielski ImgFieldNames(s) = FieldNames(n) 228*b1cdbd2cSJim Jagielski s = s + 1 229*b1cdbd2cSJim Jagielski End If 230*b1cdbd2cSJim Jagielski Next n 231*b1cdbd2cSJim Jagielski If s <> 0 Then 232*b1cdbd2cSJim Jagielski Redim Preserve ImgFieldNames(s-1) 233*b1cdbd2cSJim Jagielski bEnableBinaryOptionGroup = True 234*b1cdbd2cSJim Jagielski Else 235*b1cdbd2cSJim Jagielski bEnableBinaryOptionGroup = False 236*b1cdbd2cSJim Jagielski End If 237*b1cdbd2cSJim Jagielski If (DialogModel.optBinariesasGraphics.State = 1) And (s <> 0) Then 238*b1cdbd2cSJim Jagielski ResultFieldNames() = AddListToList(ResultFieldNames(), ImgFieldNames()) 239*b1cdbd2cSJim Jagielski Else 240*b1cdbd2cSJim Jagielski Redim Preserve ResultFieldNames(m-1) 241*b1cdbd2cSJim Jagielski End If 242*b1cdbd2cSJim Jagielski FieldNames() = ResultFieldNames() 243*b1cdbd2cSJim Jagielski DialogModel.lstFields.StringItemList = FieldNames() 244*b1cdbd2cSJim Jagielski InitializeListboxProcedures(DialogModel, DialogModel.lstFields, DialogModel.lstSelFields) 245*b1cdbd2cSJim Jagielski End If 246*b1cdbd2cSJim Jagielski GetSpecificFieldNames = MaxIndex 247*b1cdbd2cSJim Jagielski Else 248*b1cdbd2cSJim Jagielski GetSpecificFieldNames = -1 249*b1cdbd2cSJim Jagielski End If 250*b1cdbd2cSJim JagielskiEnd Function 251*b1cdbd2cSJim Jagielski 252*b1cdbd2cSJim Jagielski 253*b1cdbd2cSJim JagielskiSub CreateDBForm() 254*b1cdbd2cSJim Jagielski If oDrawPage.Forms.Count = 0 Then 255*b1cdbd2cSJim Jagielski oDBForm = oDocument.CreateInstance("com.sun.star.form.component.Form") 256*b1cdbd2cSJim Jagielski oDrawpage.Forms.InsertByIndex (0, oDBForm) 257*b1cdbd2cSJim Jagielski Else 258*b1cdbd2cSJim Jagielski oDBForm = oDrawPage.Forms.GetByIndex(0) 259*b1cdbd2cSJim Jagielski End If 260*b1cdbd2cSJim Jagielski oDBForm.Name = "Standard" 261*b1cdbd2cSJim Jagielski oDBForm.DataSourceName = sDBName 262*b1cdbd2cSJim Jagielski oDBForm.Command = TableName 263*b1cdbd2cSJim Jagielski oDBForm.CommandType = CurCommandType 264*b1cdbd2cSJim JagielskiEnd Sub 265*b1cdbd2cSJim Jagielski 266*b1cdbd2cSJim Jagielski 267*b1cdbd2cSJim JagielskiSub AddOrRemoveBinaryFieldsToWidthList() 268*b1cdbd2cSJim JagielskiDim LocWidthList() 269*b1cdbd2cSJim JagielskiDim MaxIndex as Integer 270*b1cdbd2cSJim JagielskiDim OldMaxIndex as Integer 271*b1cdbd2cSJim JagielskiDim s as Integer 272*b1cdbd2cSJim JagielskiDim n as Integer 273*b1cdbd2cSJim JagielskiDim m as Integer 274*b1cdbd2cSJim Jagielski If Not bDebug Then 275*b1cdbd2cSJim Jagielski On Local Error GoTo WIZARDERROR 276*b1cdbd2cSJim Jagielski End If 277*b1cdbd2cSJim Jagielski If DialogModel.optBinariesasGraphics.State = 1 Then 278*b1cdbd2cSJim Jagielski OldMaxIndex = Ubound(WidthList(),1) 279*b1cdbd2cSJim Jagielski If OldMaxIndex = 15 Then 280*b1cdbd2cSJim Jagielski MaxIndex = Ubound(WidthList(),1) + Ubound(ImgWidthList(),1) + 1 281*b1cdbd2cSJim Jagielski ReDim Preserve WidthList(MaxIndex,4) 282*b1cdbd2cSJim Jagielski s = 0 283*b1cdbd2cSJim Jagielski For n = OldMaxIndex + 1 To MaxIndex 284*b1cdbd2cSJim Jagielski For m = 0 To 3 285*b1cdbd2cSJim Jagielski WidthList(n,m) = ImgWidthList(s,m) 286*b1cdbd2cSJim Jagielski Next m 287*b1cdbd2cSJim Jagielski s = s + 1 288*b1cdbd2cSJim Jagielski Next n 289*b1cdbd2cSJim Jagielski MergeList(DialogModel.lstFields, ImgFieldNames()) 290*b1cdbd2cSJim Jagielski End If 291*b1cdbd2cSJim Jagielski Else 292*b1cdbd2cSJim Jagielski ReDim Preserve WidthList(15, 4) 293*b1cdbd2cSJim Jagielski RemoveListItems(DialogModel.lstFields(), DialogModel.lstSelFields(), ImgFieldNames()) 294*b1cdbd2cSJim Jagielski End If 295*b1cdbd2cSJim Jagielski DialogModel.lstSelFields.Tag = True 296*b1cdbd2cSJim JagielskiWIZARDERROR: 297*b1cdbd2cSJim Jagielski If Err <> 0 Then 298*b1cdbd2cSJim Jagielski Msgbox(sMsgErrMsg, 16, GetProductName()) 299*b1cdbd2cSJim Jagielski Resume LOCERROR 300*b1cdbd2cSJim Jagielski LOCERROR: 301*b1cdbd2cSJim Jagielski End If 302*b1cdbd2cSJim JagielskiEnd Sub 303*b1cdbd2cSJim Jagielski 304*b1cdbd2cSJim Jagielski 305*b1cdbd2cSJim JagielskiFunction CreateCommandTypeList() 306*b1cdbd2cSJim JagielskiDim MaxTableIndex as Integer 307*b1cdbd2cSJim JagielskiDim MaxQueryIndex as Integer 308*b1cdbd2cSJim JagielskiDim MaxIndex as Integer 309*b1cdbd2cSJim JagielskiDim i as Integer 310*b1cdbd2cSJim JagielskiDim a as Integer 311*b1cdbd2cSJim Jagielski MaxTableIndex = Ubound(TableNames() 312*b1cdbd2cSJim Jagielski MaxQueryIndex = Ubound(QueryNames() 313*b1cdbd2cSJim Jagielski MaxIndex = MaxTableIndex + MaxQueryIndex + 1 314*b1cdbd2cSJim Jagielski If MaxIndex > -1 Then 315*b1cdbd2cSJim Jagielski Dim LocCommandTypes(MaxIndex) as Integer 316*b1cdbd2cSJim Jagielski For i = 0 To MaxTableIndex 317*b1cdbd2cSJim Jagielski LocCommandTypes(i) = com.sun.star.sdb.CommandType.TABLE 318*b1cdbd2cSJim Jagielski Next i 319*b1cdbd2cSJim Jagielski a = i 320*b1cdbd2cSJim Jagielski For i = 0 To MaxQueryIndex 321*b1cdbd2cSJim Jagielski LocCommandTypes(a) = com.sun.star.sdb.CommandType.QUERY 322*b1cdbd2cSJim Jagielski a = a + 1 323*b1cdbd2cSJim Jagielski Next i 324*b1cdbd2cSJim Jagielski End If 325*b1cdbd2cSJim Jagielski CreateCommandTypeList() = LocCommandTypes() 326*b1cdbd2cSJim JagielskiEnd Function 327*b1cdbd2cSJim Jagielski 328*b1cdbd2cSJim Jagielski 329*b1cdbd2cSJim JagielskiSub GetCurrentMetaValues(Index as Integer) 330*b1cdbd2cSJim Jagielski CurFieldType = FieldMetaValues(Index,0) 331*b1cdbd2cSJim Jagielski CurFieldLength = FieldMetaValues(Index,1) 332*b1cdbd2cSJim Jagielski CurControlType = FieldMetaValues(Index,2) 333*b1cdbd2cSJim Jagielski CurControlName = FieldMetaValues(Index,3) 334*b1cdbd2cSJim Jagielski CurFormatKey = FieldMetaValues(Index,4) 335*b1cdbd2cSJim Jagielski CurDefaultValue = FieldMetaValues(Index,5) 336*b1cdbd2cSJim Jagielski CurIsCurrency = FieldMetaValues(Index,6) 337*b1cdbd2cSJim Jagielski CurScale = FieldMetaValues(Index,7) 338*b1cdbd2cSJim Jagielski CurHelpText = FieldMetaValues(Index,8) 339*b1cdbd2cSJim Jagielski CurFieldName = FieldNames(Index) 340*b1cdbd2cSJim JagielskiEnd Sub 341*b1cdbd2cSJim Jagielski 342*b1cdbd2cSJim Jagielski 343*b1cdbd2cSJim JagielskiFunction AssignFieldLength(FieldLength as Long) as Integer 344*b1cdbd2cSJim Jagielski If FieldLength >= 65535 Then 345*b1cdbd2cSJim Jagielski AssignFieldLength() = -1 346*b1cdbd2cSJim Jagielski Else 347*b1cdbd2cSJim Jagielski AssignFieldLength() = FieldLength 348*b1cdbd2cSJim Jagielski End If 349*b1cdbd2cSJim JagielskiEnd Function 350*b1cdbd2cSJim Jagielski</script:module> 351