Creating and Maintaining Catalogs and Dictionaries with DTO : DtoSegments Collection
 
DtoSegments Collection
A collection of DtoSegment objects representing the segments of an index.
Properties
Count
Returns the number of members in a collection.
Item
Returns a specific member of a collection.
Methods
Add method
Remove method
Clear method
Remarks
Use the Count property to find the number of members in the collection.
Example
’ Open dictionary
Dim dictionary as new DtoDictionary
Dim result as DtoResult
result = dictionary.Open("d:\mydemodata")
 
’ Get Students table
Dim students_table as DtoTable
Set students_table = dictionary.GetTable("Student")
 
’ Obtain indexes collection from students table
Dim students_idx as DtoIndexes
Set students_idx = students_table.Indexes
 
’ Delete all the indexes
Dim first_idx as DtoIndex
Set first_idx = students_idx(1)
 
’ Get DtoSegments collection from first_idx
Dim my_segments as DtoSegments
Set my_segments as first_idx.Segments
See Also
DtoSegment Object
DtoTable Object
Methods Detail
Add method
Add an item to a collection.
Syntax
result = Collection.Add(Object)
Arguments
Collection
DtoSegments collection to which to add object.
Object
A new DtoSegment object
Return Values
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.
Remarks
This method takes a parameter of type DtoSegment. Therefore, you are responsible for first instantiating the object and setting its properties before adding it to the collection.
Note You cannot use this method to add segments to preexisting PSQL tables. This method does not alter data or DDF files, and can only be used to add segments in memory before a table is created. See the example for AddTable method as a reference.
Remove method
Removes an item from a collection.
Syntax
result = Collection.Remove(segment)
Arguments
Collection
DtoSegments collection from which to remove object.
segment
A variant containing either the index (starting with 1) or the name of the item you wish to remove from the collection
Return Values
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.
Remarks
You can pass either the 1-based ordinal or the name of the segment.
Note You cannot use this method to remove segments from preexisting PSQL tables. This method does not alter data or DDF files, and can only be used to remove segments in memory before a table is created. See the example for AddTable method as a reference.
Clear method
Removes all items from a DtoSegments collection.
Syntax
result = Collection.Clear
Arguments
Collection
DtoSegments collection obtained from a DtoIndex object
Return Values
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.
Remarks
This method removes all the segments from an index in memory.
Note You cannot use this method to remove segments from preexisting PSQL tables. This method does not alter data or DDF files, and can only be used to remove segments in memory before a table is created. See the example for AddTable method as a reference.