Subject Re: [firebird-support] External Tables
Author Ann W. Harrison
hardygps wrote:
> I'd appreciate if you could point me to any documentation on defining
> external tables with these column types as well as columns defined as
> date.

The documentation is sparse because in the bad old days, different
systems stored some types in different ways. Now, the only real
problems are endian.
> Here are some specific questions:
> 1. What are the alignment requirements for date, decimal, smallint,
> bigint, integer and char data items?

Char has no alignment requirement

Varchar must be on a two-byte boundary. The first two bytes are
the actual length of the field, but the field will be stored at
its full declared length.

Smallint is stored on 2 byte boundaries.

Int is stored on four byte boundaries, as is float.

bigint requires an eight byte boundary, as does double.

DateTime is stored as two 32-bit quantities on four byte boundaries.

Date and Time are 32 bit quantities on two byte boundaries.

> 2. How must a decimal(x, y) field appear in the external table?

1) the value stored equal to the actual value times 10 ** y.

2) if x < 5, small int with two byte boundaries
else if x < 10 integer on four byte boundaries
else if x < 19 bigint on eight byte boundaries
> 3. How must a date field appear in the external table?

A 32 bit integer representing the number of days since November
17, 1858
> 4. How must a time field appear in the external table?

The number of tens of microseconds (I think) since midnight.
> 5. Is there a limit on the number of columns in an external table?

Not different from internal tables.
> 6. Is there documentation on external tables that answer any of these
> questions?

The datatype discussion in Helen's book will certainly help.