Re: FW: Informix record member as array fails compilation
Posted in 2010
Informix's 4GL development language permits you to create an array of
structures so that several rows of a table can be loaded into memory, in the
array, at one time for processing. However, Informix Dynamic Server (IDS)
is a Relational Database Management System (RDBMS) and Codd and Date's
papers SPECIFICALLY state that arrays are NOT permitted and not RDBMS worth
its salt supports them.
That said, you can simulate the effects of an array using IDS's Object
Oriented (OO) features or even using simple relational child tables. If you
are writing your applications in 4GL which does not directly support the OO
features, I would stick to relational model tables, so the master table
would look like:
create temp table ts_ac_tmp (
serial_number SERIAL,
date_started date,
lane_nr char(4),
ts_seq_nr integer,
time_started integer,
.... );
and the child table to implement the array would look like:
create temp table ts_ac_array_tmp (
serial_number integer,
left_index smallint,
right_index smallint,
audit_count integer );
Your 4GL structure would still look like a structure containing a two
dimensional array, with the array elements coming fro the child table. I've
added a SERIAL column to the parent table so that the key to the matching
ts_ac_array_tmp rows is only 4 bytes long.
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
IIUG Board of Directors (art@iiug.org)
See you at the 2010 IIUG Informix Conference
April 25-28, 2010
Overland Park (Kansas City), KS
www.iiug.org/conf
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Advanced DataTools, the IIUG, nor any other
organization with which I am associated either explicitly, implicitly, or by
inference. Neither do those opinions reflect those of other individuals
affiliated with any entity with which I am affiliated nor those of the
entities themselves.
On Tue, Jan 19, 2010 at 8:15 AM, David Reed <David.Reed@tollink.co.za>wrote:
> Hi
>
>
>
> We get the following compiler error when trying to create an Informix table
> with a member consisting of a 2-dimensional array using 4GL. Is it possible?
> Here is a copy of my code:
>
>
>
> create temp table ts_ac_tmp (>
> date_started date,
>
> lane_nr char(4),
>
> ts_seq_nr integer,
>
> time_started integer,
>
> audit_count array[7,14] of integer)
>
> |__________________________^
>
> |
>
> | A grammatical error has been found on line 38, character 28.
>
> | The construct is not understandable in its context.
>
> | See error number -4373.
>
> |__________________________^
>
> |
>
> | A grammatical error has been found on line 38, character 28.
>
> | The construct is not understandable in its context.
>
> | See error number -4373.
>
>
>
> According to Ch 35 of “Informix Unleashed”, quoted below, this should be
> possible.
>
>
>
> “INFORMIX-4GL allows you to define two exceptionally powerful data
> structures: the record and the array. The record data type is a collection
> of members in which each member can have any valid Informix data type
> (either a simple data type, another record, or an array). The array is a
> data structure of up to three dimensions of values of the same data type;”
>
>
>
> Regards
>
> David
>
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list
>
>