[fpc-pascal] Re: SQLDB/Firebird unable to open table with more than 128 fields

Joost van der Sluis joost at cnoc.nl
Sun Mar 22 12:54:11 CET 2009

Op zondag 22-03-2009 om 18:40 uur [tijdzone +0800], schreef Funky Beast:
> Joost van der Sluis wrote:
> > Op zondag 22-03-2009 om 17:37 uur [tijdzone +0800], schreef Funky Beast:
> >> I found the culprit.
> >>
> >> In TIBConnection.PrepareStatement's variable section, x was declared
> >> as a shortint
> >> which would cause problem when its used for allocating memmory for the
> >> SQLVAR elements,
> >> when there are more than 128 fields.
> >>
> >> Also same as above in TIBConnection.FreeSQLDABuffer.
> >>
> >> I changed var x in both location into smallint and everything worked
> >> fine for me.
> > 
> > You are sure that a smallint is large enough in all cases? 
> I'm not sure, but according to:
> http://www.firebirdsql.org/index.php?op=guide&id=techspec
> the approximation of maximum 16,384 integer fields could be allowed per table,
> and smallint has a range of -32768..32767, double of whats stated.
> Unless someone has more columns of smaller size data.
> Please let me know the ideal type before I prepare the patch.

It's up to you to decide, but as you stated smallint seems ok.

> Should the patch be created for trunk or fixes_22 (I was using fixes_22 to test).

In principle all patches should be made against trunk. But in this case
I don't suspect many differences so a patch against fixes will probably
also work. And else I can convert it.


More information about the fpc-pascal mailing list