Subject Re: [firebird-support] Array
Author Helen Borrie
At 12:50 PM 6/01/2004 +0100, Jonathan Neve wrote:

> >I'm with Olivier on this one, in part because I consider arrays to be a
> >useful and distinctive feature - maybe they'll be the next database fad
> >- after all Rdb/InterBase introduced the blob to the world. The other
> >part is that which says that removing features is dumb and annoys long
> >term users. Some time we should make arrays useful from procedures &
> >triggers - then they will really take off.
> >
>I know that Olivier already alluded to this somewhat, but what would be
>a good example of a situation where it would be good to use an array.
>I've never used them, because I don't really know anything about them.
>But if they could be useful, then they might be worth know a bit better.

I think the trick is for you to understand how arrays are useful in your
applications. If you are writing ESQL, you use SQL-like structures to
declare and traffic your C arrays (or slices of them) in static HTML. This
is meant to sound like a put-down, but think of how YOU want to take
advantage of the array-processing offered by your host programming language.

>Does anyone have a pratical example of a table that uses an array?

If you have access to Delphi of CPPB, there is a simple example in the
\samples database of the IB Objects evaluation kit. IBO also has a visual
control that can surface array slices to the user in a grid display.

>is the advantage of an array over simply a detail table with a foreign

I doubt it's a question of "advantage over detail table with a foreign
key". If you need that relationship, use the tables and columns. An array
stores one or more dimensions of exactly similar values. In one dimension,
it's a row of things of identical specification, in two dimensions, you
have tabulation, in three you have multiple layers of tabulations...and so on.

>What are the Pro and Cons?

Pros - Very fast and elegant way to store and process (operate on, move,
update) a lot of things of identical specification. Form linked lists,
massage statistical figures, etc. They are blobs, so you have the
capability to shift big lumps of data around at low cost.

Cons - you can't index them, sort them, etc. You have to extract them
before you can read their values. You have to understand what you want
them for. <g> No DSQL syntax for operating on array slices currently so
your app can only fetch them/deliver them in an API structure, as slices.