|
An object representing a Pervasive dictionary. This object is deprecated in favor of DtoDatabase Object . DtoDictionary can still be used only if you can specify the path to the dictionary on the Open method.
All of the operations affecting dictionary files have to be done through this object. The user can open a dictionary, create a dictionary, get table information add a table or drop a table using this object.
Note
If instantiating this object using ASP or if you use the CreateObject method in Visual Basic, the progid of DtoDictionary is "DTO.DtoDictionary.2" for DTO2, or "DTO.DtoDictionary.1" for DTO version 1. See DTO2 for more information on the differences between the two versions.
Dim result as DtoResult Dim dictionary as New DtoDictionary result = dictionary.Open("c:\pvsw\demodata")
DtoTables Collection
DtoTable Object
Opens a set of data dictionary files using either a database name or a dictionary path.
|
result
|
DtoResult long value indicating the result of the method call. Use the Error property of the DtoSession Object to obtain a description for the result.
|
Note
The path argument may either contain a path to the directory containing the DDF files or it can use a name of the database contained in the local DBNAMES.CFG. See DtoDatabases Collection in order to create and maintain database names.
This operation is used in order to open a set of dictionary files. This set must contain FILE.DDF, INDEX.DDF and FIELD.DDF. It may also contain a number of optional DDF files. Remember to call the Close method to free memory. Once the dictionary set is opened no one else can make changes to it until the Close method is called.
More information on the errors returned by the method can be obtained using the Error property of the DtoSession Object.
Dim dictionary as new DtoDictionary Dim result as DtoResult result = dictionary.Open("c:\pvsw\demodata")
Creates an empty set of data dictionary files.
|
Object
|
DtoDictionary object
|
|
path
|
absolute path to the directory in which the dictionary files to be created.
|
|
username
|
Optional user name for the DDF set
|
|
password
|
Optional password for the DDF set
|
|
result
|
DtoResult long value indicating the result of the method call. Use the Error property of the DtoSession Object to obtain a description for the result.
|
If the directory contained in path argument does not exist, an attempt will be made to create it. If operation is successful a set containing file.ddf, field.ddf, index.ddf will be created.
Remember to call Close method to free memory. Once the dictionary set is created other clients cannot open it or make changes to it until Close method is called.
More information on the errors returned by the method can be obtained using the Error property. Unlike Open method the path parameter can only contain an absolute path.
Dim Dictionary As New DtoDictionary Dim result as DtoResult result = Dictionary.Create("C:\TEST", "login", "password") If NOT result = Dto_Success Then MsgBox "Error"+ Session.Error(result) End If
Closes a set of data dictionary files. Opened using Open method or created using Create method.
|
result
|
DtoResult long value indicating the result of the method call. Use the Error property of the DtoSession Object to obtain a description for the result.
|
Call this method after the dictionary has been opened using Open method or created using Create method. Error information can be obtained using Error property.
Dim dictionary as new DtoDictionary Dim result as DtoResult result = dictionary.Open("c:\pvsw\demodata") ' ' perform operations here ' result = dictionary.Close
Adds table information to data dictionary files and creates a data file to match the definition.
|
result
|
DtoResult long value indicating the result of the method call. Use the Error property of the DtoSession Object to obtain a description for the result.
|
This method adds the table definition to the ddf files and attempts to create the data file specified in Location property of table. If Location property is left blank then this method will attempt to create a data file named tableName.mkd. If a table with such name already exists a number will be appended to the name and another attempt will be made.
In order for this operation to complete successfully at least one column must be defined.
The following example shows how to create a dictionary object and then add a table to it.
Dim Dictionary As New DtoDictionary Dim Table As DtoTable Dim Tables As DtoTables Dim result As dtoResult Dim Columns As DtoColumns Dim Indexes As DtoIndexes Dim Column As DtoColumn Dim Index As DtoIndex Dim Segments As DtoSegments Dim Segment As DtoSegment result = Dictionary.Create("C:\TEST", "login", "password") If NOT result = Dto_Success Then MsgBox "Error"+ Session.Error(result) End If ' ******* Begin AddTable ******************* Set Table = New DtoTable Set Column = New DtoColumn With Column .Decimal = 0 .Flags = dtoColumnNullable .ISR = "" .Name = "F_Int" .Number = 0 .Size = 4 .Type = dtoTypeInteger End With Table.Columns.Add Column Set Column = New DtoColumn With Column .Decimal = 4 .Flags = dtoColumnNullable + dtoColumnCaseInsensitive .ISR = "" .Name = "F_Str" .Number = 1 .Size = 55 .Type = dtoTypeLString End With Table.Columns.Add Column Set Column = New DtoColumn With Column .Decimal = 4 .Flags = dtoColumnCaseInsensitive .ISR = "" .Name = "F_Str_Second" .Number = 2 .Size = 100 .Type = dtoTypeLString End With Table.Columns.Add Column Set Column = New DtoColumn With Column .Decimal = 10 .Flags = dtoColumnDefault .ISR = "" .Name = "F_Float" .Number = 3 .Size = 0 .Type = dtoTypeBFloat End With Table.Columns.Add Column 'Add Indexes Set Index = New DtoIndex result = Index.AddSegment("F_Int", 0) Set Segment = New DtoSegment Segment.Number = 0 Segment.ColumnName = "F_Int" Segment.Flags = dtoSegmentAscending Index.Segments.Add Segment Index.Name = "FintInd" Index.Number = 0 Index.Flags = dtoIndexModifiable Table.Indexes.Add Index 'Add second Index: Set Index = New DtoIndex Set Segment = New DtoSegment Segment.Number = 0 Segment.ColumnName = "F_Str" Segment.Flags = dtoSegmentAscending Index.Segments.Add Segment Set Segment = New DtoSegment Segment.Number = 1 Segment.ColumnName = "F_Str_Second" Segment.Flags = dtoSegmentAscending Index.Segments.Add Segment Index.Name = "FStrTagInd" Index.Number = 1 Index.Flags = dtoIndexModifiable Table.Indexes.Add Index Table.Overwrite = true Table.Flags = dtoTableTrueNullable Table.Name = "Table3" result = Dictionary.AddTable(Table) If NOT result = Dto_Success Then MsgBox "Error"+ Session.Error(result) End If
Remove a table from the current dictionary.
|
Object
|
DtoDictionary object
|
|
tableName
|
Name of the table to be dropped
|
|
deleteFile
|
A boolean value indicating whether the underlying data file should be deleted.
|
|
result
|
DtoResult long value indicating the result of the method call. Use the Error property of the DtoSession Object to obtain a description for the result.
|
Note that the dictionary has to be opened successfully for this operation to succeed.
result = Dictionary.DropTable("Table3", true)
If NOT result = Dto_Success Then
MsgBox "Error"+ Session.Error(result)
End If
Refreshes a dictionary object.
|
result
|
DtoResult long value indicating the result of the method call. Use the Error property of the DtoSession Object to obtain a description for the result.
|
Deletes dictionary object and the corresponding DDF files.
|
result
|
DtoResult long value indicating the result of the method call. Use the Error property of the DtoSession Object to obtain a description for the result.
|
|
Chapter contents
Prev topic: DtoDSN Object
|