SQLdb; packetrecord not working wel in DBGrid
lazarus / 16-Databases
----------------------------------------------------------------------
mangakissa · 2013-11-28 18:26
I was creating a form to get al my records of my table in a dbgrid.
The packetrecord was set to default (10). The dbgrid can't handle the
data right There were a lot of records with the ID 0.
Setting the paketrecord to -1 went well. So I think this is a bug.
----------------------------------------------------------------------
kpeters58 · 2013-11-29 04:10
You won't get much help unless you give us a LOT more information,
such as:
Lazarus versionOSDatabaseComponents usedSQL codeetc. etc.
----------------------------------------------------------------------
mangakissa · 2013-11-29 07:48
I'm sorry.
Lazarus build 1.0.12
Windows Vista (not shure on Windows
Firebird (embedded)
TIBConnection, TSQLTransaction, TSQLQuery, TDatasource, TDBGrid,
TDBedit
standard SQL code (SELECT * FROM
)
Strangest thing is all records are fetched, but it should only be 10
each time (as far as I know packetrecord works like that)
Pascalcode is simple. Just open the table.
----------------------------------------------------------------------
BigChimp · 2013-11-29 08:03
Where is the code? Post the project and database DDL.
http://wiki.lazarus.freepascal.org/Database_bug_reporting
also: what firebird version? 2.5?
----------------------------------------------------------------------
mangakissa · 2013-11-29 15:01
firebird 2.5 embedded
I noticed something else. It is a combination of indexfieldnames and
packetrecords.
I made the indexfiledname empty and it works. But in my situation not
a workaround.
----------------------------------------------------------------------
BigChimp · 2013-11-30 09:26
Very good, thanks!
Possible workaround (at least according to docs): you can set up an
index in the db on NAAM, then use IndexName.
Edit: seems Lazarus is not Delphi; won't work; see
http://forum.lazarus.freepascal.org/index.php?topic=6146.0
I imagine this can improve performance as well...
I've fixed up your example a bit - pls find it attached.
- Database name+ encoding in DDL as a comment
- Form: change db name to make it easier to use one in the current
directory, whichever directory you're in.
- add missing generator to ddl
- SQL script saved without utf8 BOM so it works with Flamerobin,
probably other tools
For convenience, I've included the FB 2.5 embedded database as well.
I'd suggest reporting this bug on the bugtracker in the Lazarus db
components (though it may well lead to an FPC sqldb database layer
bug), mentioning that
- packetrecords left at default (10)+indexfieldnames leads to a lot of
bogus? records with ID 0
- packetrecords changed to -1 works ok
- removing indexfieldnames and leaving packetrecords at 10 works ok
or something similar
FYI: some forum search hits.
IndexFieldNames seems broken/has problems:
http://forum.lazarus.freepascal.org/index.php?topic=17020.0
and
http://forum.lazarus.freepascal.org/index.php?topic=17465.0
Bugs that may or may not be related.
25314: TCustomBufDataset.InternalClose method crushes in case of
TSQLQuery.IndexFieldNames not empty
http://bugs.freepascal.org/view.php?id=25314
Fixed in FPC 2.7.1, not in 2.6.x
----------------------------------------------------------------------
BigChimp · 2013-11-30 09:41
Just tested with Win Laz trunk r43478, FPC 2.7.1 x86 r26152. Same
problem.
BTW: you mention you need indexfieldnames. Can't you use an ORDER BY
in your SQL query instead?
----------------------------------------------------------------------
mangakissa · 2013-11-30 10:42
Yes, but after inserting a record, The dataset shall be sorted again
(that should be the case (Delphi works like that). But an 'ORDER BY'
could solve the problem. I haven't test it yet.
----------------------------------------------------------------------
mangakissa · 2013-11-30 11:32
Bug reported : 0025387