Data Selection and Retrieval Commands

Similar to general SQL concepts, a data query is made to select particular parts of the data source resulting in graphic primitives. The form of selection is very much translator-specific. Each interface will have its own syntax for the select command.

As a result of a data selection command an interface will construct a class from the data columns selected. This class holds the names and data types of the columns. Before the data is fetched (via the objfetch command), a class name (and optionally a type) may be supplied so that this can be sent to the client telling it the structure of the data it will receive. This class definition is not sent automatically but must be requested by the client (via a fetch_class command) before issuing the objfetch.

Once data has been selected, it can be fetched and sent to the client as an eim output stream. The objfetch or draw commands perform this function. Database interfaces also support the standard SQL fetch command, in which case the class information is not used since the client is expected to know the type of data.

For geometric data, a geometric constraint can be specified to restrict the fetched data to a specific area. Only graphic primitives which clash with the area are fetched. This is done via the set clip command. Note that clipping does not actually clip graphic primitives. A set clip command may occur in a startup script, in which case it will be applied at the beginning of each client session.

select

select {* | <column>, <column>, …} from <table> where <condition>

Constructs a query to be subsequently run by a fetch-type command resulting in a set of graphic primitives with or without meta-data to be sent to the client in the eim output stream. The syntax of this command is translator-specific. The definition above is typical for most interfaces.

iselect

iselect {* | <column>, <column>, …} from {<systable> | <table>} where <condition>

Constructs a query on system information to be subsequently run by a fetch-type command resulting in a set of non-graphic data to be sent to the client in the eim output stream.

The table may be a system table or a data source table. The system tables are as follows:

fxtablesDetails of all tables available for selection
fxinfoGeneral information about the interface
fxcommandsNames of all commands available to the interface.

If the table is a data source table, then the columns provide meta-data about each column in the table.

A simple way to discover column details for these tables is via the following command sequence:

select * from <table>
list_class

set classname

set classname=<client_class_name>

Provides a client name for the class of the current query. If the client does not already have the definition of this class a subsequent fetch_class command will fetch the class definition for creation on the client.

If an attempt is made to fetch non-graphic column data without first setting a class, the interface will derive a suitable class name.

set classtype

set classtype=C | G | S | E

Provides a client structure type for the class of the current query. 4 variations are possible:

CA compound, where the structure contains graphic child elements
GA gstructure, where the structure has a graphic value but no graphic child elements
SA structure, where the structure has no graphic value or child elements
E Raw entities, where no structure is created and only the graphic values are retrieved by a subsequent objfetch command

If the client does not already have the definition of the resulting class, a subsequent fetch_class command will fetch the its definition for creation on the client in readiness for a subsequent fetch-type command.

The default value is interface-specific, usually G for file-based interfaces, and C for database interfaces.
There is an exception to this default rule: if a select is made of just one datasource column and the column is of type graphic, and a classtype has not been specified, or a default classtype was not defined in a startup script, then classtype E is assumed.

set clip

set clip=(<xmin>,<ymin>{,<zmax>}) (<xmax>,<ymax>{,<zmax>})

Defines a clipping region to impose geometric constraints on the selection. The region may be 2 or 3-D. Only primitives which clash with the region are subsequently fetched. The co-ordinate sets should be space-separated.

Multiple sets of clipping regions may be provided by adding extra pairs of co-ordinate sets to the command line.

This command must follow the select command to which it relates.

set noclip

set noclip=(<xmin>,<ymin>{,<zmax>}) (<xmax>,<ymax>{,<zmax>})

Defines an inverse clipping region to impose geometric constraints on the selection. The region may be 2 or 3-D. The inverse clipping region is added to the standard clipping region (defined by the set clip command) to remove areas from the total.

Multiple sets of inverse clipping regions may be provided by adding extra pairs of co-ordinate sets to the command line.

This command must follow the select command to which it relates.

set memlimit

set memlimit=<n>

Defines a process memory limit (in megabytes) for the interface. If the execution of a query causes the process to exceed this memory limit the process is terminated after execution of the query. This command is available on Microsoft Windows systems only.

This setting applies to network services only and caters for the case where a query devours so much memory that it adversely affects system performance for subsequent queries, and other running processes. This setting should not be necessary since interfaces endeavour to reclaim all used memory after each query. However some interfaces make use of 3rd-party libraries which do not free up memory after use (Oracle libraries fall into this category).

The action of shutting down a process ensures the release of memory, and the service will be automatically restarted by the Service Broker on the next request to the service.

This command may only be executed within a startup script, otherwise it is ignored.

set objectcolumn

set objectcolumn=<column>

Indicates that objects retrieved by objfetch are to be individually named. The name for each object will be derived from the value of <column> on the partocular row being fetched. This column name must be one of those selected in the select statement and must have a string or numeric value. Consequently the column values must be unique across the data set.

Each object name can also share a common prefix by using the set objectprefix command.

This command must follow the select command to which it relates.

set objectprefix

set objectprefix=<text>

Combined with the set objectcolumn command, defines a prefix for all objects named from column values.

This command must follow the select command to which it relates.

set prefetch

set prefetch=<number_of rows>

Sets the fetch row buffer count for block data retrieval. This is an internal setting for performance optimization and should rarely need changing. The default value is set to 20. It is not implemented by all interfaces.

fetch_class

fetch_class

Returns class information to the client, for the creation of a class definition constructed from meta-data of the current select (or iselect) query. The class name and type can be specified by the set command. If no class name has been supplied, a suitable name will be generated and used in any subsequent objfetch command when fetching the data.

objfetch

objfetch {into} <client_name>

Fetch all data rows and send to the client for storage. The client will display them and store them locally as individual objects or an array of objects (depending on current settings). The class of the objects will be derived from the current query and may have been assigned a name and/or general type (by the set classname or set classtype commands. If <client_name> is provided, it provides a name for the array, otherwise the objects may or may not be individually named depending on the current objectcolumn and objectprefix settings.

draw

draw

Fetch the data and send to the client for draw only purposes. The client will display it and then forget about it. Only graphics will be sent.

set single_vectors

set single_vectors={<value>}

By default, single line vectors are output as such, but sometimes a requirement is for single line vectors to be output as polylines of length 1. If the client application is Fire, then a single line vector is created as a vector entity, but a polyline is created as a lines entity. The default value for this setting is 1.

Running example

Client session:

# Fetch base polygons (no meta-data)
# There are no columns specified to select just the graphics
select from austwater.pat
set clip=(6250000,2050000) (6850000,2650000)
objfetch
 
# Fetch town points (with meta-data)
select mctown-id, state from mctown.pat where population > 10000
# Same clipping region still applies
# Provide a client class name
set_classname=~arc.mctowns_t
# Fetch the class definition created by the query
fetch_class
# Fetch the data into an array called mctowns
objfetch into mctowns