Subject Re: [firebird-support] Re: External table, Timestamp field value padded?
Author Ann W. Harrison
Bert_Herngreen wrote:
>>> Why is the Timestamp field value padded with 'zero' when it is combined
>>> with (var)char fields?
> --- In firebird-support@yahoogroups.com, Dimitry Sibiryakov <sd@...> wrote:
>> Every value in external tables is aligned. And this alignment depends
>> on data type. Timestamps are aligned to 8 bytes.
>> For details you can search for thread with subject "Alignment of
>> ISC_TIMESTAMP" in firebird-devel list.
>>
>
> Maybe I misunderstood your answer, but the Timestamp IS 8 bytes
> (30 D7 00 00 70 12 EB 14). My question was about the 7 'zero'
> bytes that are inserted before the TimeStamp field, after the
> 20's from the char(21). These appear in case 3 only, not in case 1
> or case 2.
>

Ah, was Dimitry said was not that the timestamp had to be eight bytes
long, but that it had to be *aligned* on an eight byte boundary. The
first byte of the timestamp field must be on a byte with an address that
is evenly divisible by eight.

As a general rule, data stored in external tables should be stored as
char(n) to avoid problems with alignment and file systems that assume
that some byte combinations have special semantics.

Good luck,

Ann