TSQLQuery.Filter produces issues with TDBGrid
Original Reporter info from Mantis: mike.cornflake
-
Reporter name: Mike Thompson
Original Reporter info from Mantis: mike.cornflake
- Reporter name: Mike Thompson
Description:
Connect a TSQLQuery to a TDBGrid. Apply a TSQLQuery.Filter, then using the DBGrid vertical scroll bar to navigate through the records. Eventually you will hit a "Could not find the requested record".
I apologise, but I've been unable to get debugging inside FCL working, so I can't work out what's going on. The exception is being raised inside procedure TCustomBufDataset.SetRecNo(Value: Longint); I only know this as this is one of only places the exception gets raised, and the other location is apparently irrelevant.
This issue appears to be related to some other open issues relating to TSQLQuery.RecordCount (http://bugs.freepascal.org/view.php?id=12238). I'm not adding this report to that issue because I agree with the assessment there that RecordCount shouldn't be updated automatically. It can be an expensive call sometimes...
Other than that small clue, I've no idea what's going on.
This issue has been confirmed with connections back to MySQL, SQLite and MS SQL, so appears to be database engine independent.
I have only tested this under Windows 8 64bit.
Steps to reproduce:
Run the attached project (win 32 only I'm afraid). (I've included a compiled exe and the required SQLite dll)
Click btnConnect once.
Click btnAddRecords twice (each time adds 10,000 records).
Click btnFilter.
Try to scroll the DBGrid using the vertical scrollbar (grab the thumb, drag to a new position and let go.) Dragging may work a few times, but you'll eventually hit the problem (obviously when you finally end up on a record that the DBGrid thinks is still in the TDataset, but which the TDataset has filtered out).
Additional information:
Originally reported over a year ago in the forums (http://forum.lazarus.freepascal.org/index.php/topic,17615.0.html). We got sidetracked in the discussions there though...
Mantis conversion info:
- Mantis ID: 25052
- OS: Windows 8
- OS Build: 64 bit
- Platform: Windows
- Version: 1.0.12
- Fixed in version: 1.1 (SVN)
- Fixed in revision: 39124 (#5df13d5c)
- Target version: 1.2.0
- LazTarget: 1.2