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

2009-03-22 Thread Joost van der Sluis
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 weather it will impact any parts of TIBConnection, so
 I will leave it to the fcl-db governors to decide. 

Can you attach a patch to the bug-report? And maybe give your real name
so we can add that to the svn-log? (In the case that 'Funky Beast' is
your real name, my apologies. ;) )

Joost.




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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

2009-03-22 Thread 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=guideid=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.

 
 I'm not sure weather it will impact any parts of TIBConnection, so
 I will leave it to the fcl-db governors to decide. 
 
 Can you attach a patch to the bug-report? And maybe give your real name
 so we can add that to the svn-log? (In the case that 'Funky Beast' is
 your real name, my apologies. ;) )
 
 Joost.
 

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

Regards,
Funky Beast
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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

2009-03-22 Thread Joost van der Sluis
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=guideid=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.

Joost.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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

2009-03-22 Thread Funky Beast
Joost van der Sluis wrote:
 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=guideid=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.
 
 Joost.
 
 ___
 fpc-pascal maillist  -  
 fpc-pascal-pd4fty7x32k2wbthl531ywd2fqjk+...@public.gmane.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal
 

Done.

Regards,
Funky Beast
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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

2009-03-21 Thread Funky Beast
Hi Joost,

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?
 
Thanks, I didn't know I need to create seperate TSQLQuerys for each sql 
statement.

 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.
 
I did, and posted the program in the bugtracker.

try the program with the following commands:
./sqldb_test 128 (this will create a database table with 129 fields, adds 1 
record and exit)
./sqldb_test (this will simply open the table with does a 'select * from 
datatable')

And he output is:
An unhandled exception occurred at $080B309C :
EIBDatabaseError :  : Fetch :
 -Dynamic SQL Error
 -SQL error code = -804
 -Incorrect values within SQLDA structure
  $080B309C  TIBCONNECTION__CHECKERROR,  line 155 of ibconnection.pp
  $080B50DB  TIBCONNECTION__FETCH,  line 693 of ibconnection.pp
  $080ADB7E  TCUSTOMSQLQUERY__FETCH,  line 965 of sqldb.pp
  $080E7AEB  TBUFDATASET__LOADBUFFER,  line 1524 of bufdataset.pas
  $080E7512  TBUFDATASET__GETNEXTPACKET,  line 1438 of bufdataset.pas
  $080E6B21  TBUFDATASET__GETRECORD,  line 1273 of bufdataset.pas
  $080911DC  TDATASET__GETNEXTRECORD,  line 743 of dataset.inc
  $08091388  TDATASET__GETNEXTRECORDS,  line 772 of dataset.inc
  $0809255D  TDATASET__RECALCBUFLISTSIZE,  line 1084 of dataset.inc
  $0809005B  TDATASET__DOINTERNALOPEN,  line 409 of dataset.inc
  $08091C0A  TDATASET__OPENCURSOR,  line 918 of dataset.inc
  $0809216F  TDATASET__SETACTIVE,  line 1017 of dataset.inc
  $080AD4D7  TCUSTOMSQLQUERY__SETACTIVE,  line 876 of sqldb.pp
  $0809557C  TDATASET__OPEN,  line 1950 of dataset.inc
  $08048E53  TSQLDB_TEST_FUNCTION__OPEN_QUERY,  line 147 of sqldb_test.pas
  $08048ED8  main,  line 159 of sqldb_test.pas

Regards,
Funky Beast


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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

2009-03-21 Thread Funky Beast
Graeme Geldenhuys wrote:
 On Fri, Mar 20, 2009 at 5:27 PM, Funky Beast 
 funkybeast-s7p20sfedvbhupcrv1q...@public.gmane.org wrote:
 Its Firebird 2.0.3, that bug only appears in sqldb/firebird combination.
 The same table that this combo can't open, opens successfully with
 fblib-0.85, flamerobin and fenixsql.
 
 Then in must be a SqlDB issue.  By the way, if you are using FBLib, I
 suggest you get the updated version. I have been maintaining (bug
 fixing) FBLib since 0.85 release. The original author is nowhere to be
 found, so I added FBLib to the tiOPF repository in SourceForge.
 
 http://tiopf.svn.sourceforge.net/viewvc/tiopf/3rdParty/FBLib/
 
 I tagged the 0.85 release so you can do a diff to see what was changed
 and fixed.
 
 Regards,
   - Graeme -
 
 
 ___
 fpGUI - a cross-platform Free Pascal GUI toolkit
 http://opensoft.homeip.net/fpgui/
 ___
 fpc-pascal maillist  -  
 fpc-pascal-pd4fty7x32k2wbthl531ywd2fqjk+...@public.gmane.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal
 

Thanks, I will check out the update from your repository.

Regards,
Funky Beast
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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

2009-03-20 Thread Funky Beast
Graeme Geldenhuys wrote:
 2009/3/20 Funky Beast funkybeast-s7p20sfedvbhupcrv1q...@public.gmane.org:
 I've found a bug in sqldb/firebird.
 Its reported here, with sample project to reproduce:
 http://bugs.freepascal.org/view.php?id=13340
 
 
 What version of Firebird? How many bytes does a single record require?
  Maybe you reached the table limit in Firebird RDBMS? If I remember
 correctly MS SQL Server 2000 had  a record size byte limit and I would
 imagine other RDBMS's have something similar.
 
 
 Regards,
   - Graeme -
 
 
 ___
 fpGUI - a cross-platform Free Pascal GUI toolkit
 http://opensoft.homeip.net/fpgui/
 ___
 fpc-pascal maillist  -  
 fpc-pascal-pd4fty7x32k2wbthl531ywd2fqjk+...@public.gmane.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal
 

Hi,

Its Firebird 2.0.3, that bug only appears in sqldb/firebird combination.
The same table that this combo can't open, opens successfully with
fblib-0.85, flamerobin and fenixsql. There's a sample project in the bug
report which generates a firebird database file with a table that produces
the bug automatically. All fields are *integer* fields.
You can generate any number of fields by executing the sample project
with an integer argument. It failed at 128.
I'm aware of the size limit, but the bug appears way below the limit
(Firebird docs says you can have approximately 16,000 integer fields
per taable).

I'm guessing that somewhere in ibase60.inc or TIBConnection might
have a misplaced declaration between shortint/smallint.(I'm basing
this on hunch that a short type has a range of -128..127)


Regards,
Funky Beast
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal