July 2010
Intermediate to advanced
840 pages
16h 33m
English
Another approach to faking a multidimensional array is to map arrays into a table with an integer column for each subscript, thus:
CREATE TABLE Foobar (i INTEGER NOT NULL PRIMARY KEY CONSTRAINT valid_array_index CHECK(i BETWEEN 1 AND 5), element REAL NOT NULL);
This looks more complex than the first approach, but it is closer to what the original Pascal declaration was doing behind the scenes. Subscripts resolve to unique physical addresses, so it is not possible to have two values for foobar[i]; hence, i is a key. The Pascal compiler will check to see that the subscripts are within the declared range; hence the CHECK() clause.
The first advantage of this approach is that multidimensional arrays are easily ...
Read now
Unlock full access