Data readers, memtables and result sets, Using an ado.net data provider, Using an – Pitney Bowes MapXtreme User Manual

Page 172: Ado.net data provider

Advertising
background image

Chapter 8: Working with Data

Table Metadata (TableInfo)

MapXtreme v7.1

179

Developer Guide

Data from Third-Party Web Services

MapXtreme can integrate Web service XML or GML output into the Catalog for use in a MapXtreme
desktop or web application. Data can be brought into the Catalog and converted to a MultiPolygon,
LineString, Point, or other Geometry via the MapXtreme API. MapXtreme then turns the Geometry
into a FeatureCollection, and, in turn, saves it to a memTable or native TAB format.

This approach is appropriate also if you wish to make data available for use in MapXtreme, but not
necessarily for map display.

Data Readers, MemTables and Result Sets

The methods to access data return a data reader or result set. A data reader allows access in a
sequential manner and does not store copies of data. It retrieves the data from the data source,
except in the case where the data source is cached. Result sets are collections of keys. These keys
allow you access back to the original tables and do not create copies of the data.

A MemTable also allows you to store data from various sources into one table. This table type stores
data in a combination of memory arrays and temporary disk storage. When data is added, the
MemTable makes a copy of the data and does not have a key or pointer back to the original table.
These are useful for temporary layers for maps and containers for return values of processes such
as a geocoding or routing result. MemTable access and map rendering performance is equivalent to
native tables.

Result sets are a great tool when you need access to a defined set of rows and when you need to
get data from the source. If the source data may change during your session then this method allows
you to see the results if the data source supports concurrent access. Since MemTables are copies of
data they are a static set of data rows and will not reflect changes from the original data sources.

Using an ADO.NET Data Provider

Data that cannot be directly accessed with a specific TableInfo data source can use
TableInfoAdoNet. The ADO.NET table can be in one of two forms: DataTable (a collection of rows
from a single table kept in-memory and allows read-write access); or IDbCommand (an SQL
statement executed at the data source that yields read only, dynamic data).

Accessing Data in a DataTable

When using a DataTable, the Catalog is essentially holding on to a reference to the DataTable you
supply to the call to Catalog.OpenTable (using the TableInfoAdoNet class). DataTables are editable
using the MapInfo ADO.NET Data Provider by issuing Insert, Update, and/or Delete commands.
Your application may continue to access the DataTable directly as well. Note, however, that the
structure of the table should not be changed while the Catalog has a reference to it. Also note that
changes to the data outside of the MapInfo Data Provider (e.g., without using the MICommand to
issue Insert, Update, or Delete commands) will not result in the raising of the insert, update, or
delete table events.

The DataTable contains almost enough information for the Catalog to define the table. For string
columns, however, the Catalog needs to assign a length to this field. The length would be used when
constructing temporary indices, temporary tables for aggregation, etc. For these types of operations,

Advertising