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

Funky Beast funkybeast at pacific.net.sg
Sun Mar 22 10:37:20 CET 2009

Joost van der Sluis wrote:
> Op vrijdag 20-03-2009 om 22:38 uur [tijdzone +0800], schreef Funky
> Beast:
>> I've found a bug in sqldb/firebird.
>> Its reported here, with sample project to reproduce:
>> http://bugs.freepascal.org/view.php?id=13340
> You are using one TSQLQuery object for all sorts of actions. Try to
> create a new TSQLQeury for every sql-statement you execute. See if that
> helps.
> And firebird doesn't allow sql-statements which changes the database
> (like alter table) within the same transaction as a select-statment. Are
> you sure you're not doing this?
> And the comparision with flamerobin and such is useless. In flamerobin
> you're not running this program which does a lot of strange things.
> Try a simple program which only does a 'select * from table' - You'll
> see that it will work.
> ie: debug your program and try to isolate the bug.
> Joost.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal-PD4FTy7X32k2wBtHl531yWD2FQJk+8+b at public.gmane.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

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.

I'm not sure weather it will impact any parts of TIBConnection, so
I will leave it to the fcl-db governors to decide.

Funky Beast

More information about the fpc-pascal mailing list