ReadDbaseMods

Synopsis

Suite of low-level modules to read Borland dBASE files (.dbf). Originally designed for use by the Arc/Info Shape File reader.


Interface Specification:

ReadDBFType

  module ReadDBFType {
      string+IPort2 DBFFileName;
      string+IPort2 ColumnName;
      int+IPort2    ColumnNumber;
      int+OPort2 ColumnType;
  };

ReadDBFDate, ReadDBFFloat, ReadDBFInteger, ReadDBFLogical & ReadDBFString

   module {
      string+IPort2 DBFFileName;
      string+IPort2 ColumnName;
      int+IPort2    ColumnNumber;
      int NumberOfValues;
      prim+OPort2 ColumnValues[NumberOfValues];
   };

Description

This library contains a suite of low-level modules for reading dBase database files. The Borland dBase format is a popular database storage format that allows database columns and rows to be stored in a binary structured file. Each column in the database can have a different data type. Hence the module suite contains a module that discovers the type of a column and a column reading module for each type of data. If the specified column is valid and of the appropriate type the column reading module will read the contents of column into an array.

This suite of modules works as a stand-alone dBase reading system. However the suite was originally developed to be used with the ReadShape project that reads Arc/Info Shape files. In the Arc/Info Shape format attributes of the geometry, such as city names, are stored in dBase files. As this suite will generally have to be used as part of a larger system no high-level macros have been developed. An example of the use of this suite can be found in the ReadDbaseEg example application.

The current version of the ReadDbase project adds support for 64 bit platforms. This support has currently only been tested on a SGI Origin 2000.

Modules:

ReadDBFDate Extracts Date Column
ReadDBFFloat Extracts Floating Point (Real) Column
ReadDBFInteger Extracts Integer Column
ReadDBFLogical Extracts Logical Column
ReadDBFString Extracts String Arrays
ReadDBFType Identifies Types

Inputs

DBFFilename

The name of the file that should be read from. The parameter is of type string. The filename should specify the full path name of the file.

ColumnName

The name of the column that should be read into an array. The parameter is of type string. If a column number is also provided then the column name should match the column number.

ColumnNumber

The number of the column that should be read into an array. The parameter is of type int. If a column name is also provided then the column name should match the column number. The first column is numbered 1.

Outputs

ReadDBFType

ColumnType

A integer value specifying the data type of the column being examined. The data type can be derived from the resulting value as follows:

  1. string
  2. date
  3. logical
  4. integer
  5. float

A value of zero means that the data type was found to be invalid.

ReadDBFDate, ReadDBFFloat, ReadDBFInteger, ReadDBFLogical & ReadDBFString

NumberOfValues

A integer value specifying the number of values in the column that is being read from. This is used to size the output array that contains the values read from the column.

ColumnValues[]

An array of primitive values containing the data read from the dBase file. The exact type of the array is dependent upon the data type of the data being read. ReadDBFFloat, ReadDBFInteger and ReadDBFString have output arrays of float, int and string as would be expected. As AVS/Express does not have a logical or date data type, ReadDBFLogical is read into a char array and ReadDBFDate is read into a string array. The size of output array is given by the NumberOfValues property.

Utility Modules

The ReadDbase suite of modules does not have any user or functional macros. The comb_mesh_and_data module is provided. However this module simply replicates the behaviour of the DVcomb_mesh_and_data module so that the example application can be used with the Visualization edition of AVS/Express.

Example

An example application ReadDbaseEg is provided that reads a supplied dBase file and generates a very simple map from it. The data file contains the coordinates, names, populations and sample dates of several cities. The application reads these values and maps the city names to text-glyphs and the population size to proportionally sized diamond glyphs.

Files

iac_proj/rd_dbase/rddbmods.v contains the V definitions of the suite of dBase reading modules.

iac_proj/rd_dbase/rddbmacs.v contains the V definitions of the comb_mesh_and_data macro and the ReadDbaseEg example application.

Other Notes

This suite of dBase reading modules is implemented by an underlying C++ class system, which is then connected to the AVS/Express cxx module system. Not all possible DBF file entities are mapped. This set of modules has only been extensively tested with DBF files from Arc/Info.

The low-level ReadShapeMods library containing the low-level module suite does not specify a process. By default the express process will be used.

Author

Steve Walker
Advanced Visual Systems, Inc.
Hanworth Lane, Chertsey Surrey, UK
KT16 9JX

Modifications

Andrew Dodd
International AVS Centre

Contact

International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
United Kingdom
M13 9PL

See Also