Closing a table, Packing a table, Closing a table packing a table – Pitney Bowes MapXtreme User Manual

Page 163

Advertising
background image

Chapter 8: Working with Data

Working with Catalog and Tables

MapXtreme v7.1

170

Developer Guide

TableEnumerators

Table enumerators may be obtained through the various overloaded EnumerateTables methods. A
table enumerator may be created with a filter. The filter determines which tables are actually
included in the enumeration while the enumerator simply provides the mechanics of enumeration.
You can create your own table filters to use in the TableEnumerator. You can also create your own
table enumerator by implementing the ITableEnumerator interface.

VB example:

Public Shared Sub MapInfo_Data_Catalog3(ByVal catalog As Catalog)
Dim te As ITableEnumerator = _
catalog.EnumerateTables(TableFilterFactory.FilterEditableTables())

While te.MoveNext()
Dim tbl As Table = te.Current

End While
End Sub

Closing a Table

Three methods are available to close tables. MapInfo.Data.Catalog.CloseAll closes all open tables
while Catalog.CloseTable closes a single, open table. The Table class also has a Close method.

Packing a Table

The MapInfo.Data.Table.Pack method removes records from the table that were previously marked
for deletion. When the table is packed, the table's TablePacked event is raised. The arguments for
the event indicate whether or not the table's keys changed as a result of the pack (which would be
caused by removing deleted records). Keys only change if the PackType includes
RemoveDeletedRecords and if there actually were deleted records in the middle of the table. If the
only deleted records in the table are at the end of the table, then no keys are changed. The event
does not indicate that keys were changed.

L

Since ResultSet tables hold collections of keys, these are vulnerable to pack operations on
the table from which they were derived. The ResultSet is no longer valid if the keys have
changed.

PackType Enumeration provides you with the following options.

PackGeometry – Indicates that the geometry objects are packed. Packing the objects attempts
to remove as much unused space as possible. A fully packed RTree (the spatial index used to
spatially access the geometry objects) may reduce performance by causing many more
unnecessary reads. To balance disk space and processing speed, packing the geometry objects
may continue to leave some unused space in the RTree. Also note: a packed RTree results in a
slight performance penalty for insert and update operations as there is a higher likelihood that
the RTree needs to be expanded.

Advertising