Recent

Author Topic: DBGrid error on scrolling, after SQLQuery filter applied  (Read 36357 times)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: DBGrid error on scrolling, after SQLQuery filter applied
« Reply #30 on: September 17, 2013, 07:51:40 am »
Re filtering syntax:
AFAIU/AFAIR sqldb's bufdataset is used for keeping track of the data displayed by the Lazarus data controls (but it has been a while since I looked & I'm not a GUI guru).

Bufdataset uses the same filtering code as tdbf. TDBF (filtering) documentation:
http://sourceforge.net/projects/tdbf/files/TDbf%20documentation/TDbf%20documentation%201.1/
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: DBGrid error on scrolling, after SQLQuery filter applied
« Reply #31 on: September 17, 2013, 08:08:49 am »
Ta for the info.  Looking now...

I can tell you that the error is only raised in two places.  I can't remember the second, it seemed very unlikely.  But the likely point the error was raised was TBufDataset.SetRecNo, so the documentation you've pointed me should be relevant...

Quick question:  How I debug lcl and fp units?  (ie step into?) Used to happen for me, but somewhere along the line I've unticked something critical, and I canna find it again...
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: DBGrid error on scrolling, after SQLQuery filter applied
« Reply #32 on: September 17, 2013, 08:26:53 am »
Quick question:  How I debug lcl and fp units?  (ie step into?) Used to happen for me, but somewhere along the line I've unticked something critical, and I canna find it again...
Compiling FPC and Lazarus with something like fpcopt=-g -gw and lazopt=-g -gw in your make statements/equivalent options for lazarus (obviously, I'm an fpcup user ;) so have set it in fpcup) to get debug info into the FPC&Laz PPUs.

However, in at least on my case, I haven't been able to debug x86 Win FPC trunk applications for a long time now, perhaps due to bugs such as
http://bugs.freepascal.org/view.php?id=20296
Recent changes in dwarf crash heaptrc in lnfodwrf.pp
(from 2011!)
Fortunately, since a while, x64 Win FPC debugs nicely again, so I use that.
Linux seems to be a bit better.
« Last Edit: September 17, 2013, 08:29:45 am by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: DBGrid error on scrolling, after SQLQuery filter applied
« Reply #33 on: September 17, 2013, 09:29:12 am »
@Big Chimp - you're the MAN :-)   Once again, many thanks :-)
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: DBGrid error on scrolling, after SQLQuery filter applied
« Reply #34 on: September 19, 2013, 07:36:44 am »
I'm now convinced the Filtering code is correct.  I've no clue what's going on, as I just can't get debugging of fpc code working.

I've raised an issue in the tracker...
http://mantis.freepascal.org/view.php?id=25052
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

jwhitten

  • Jr. Member
  • **
  • Posts: 61
Re: DBGrid error on scrolling, after SQLQuery filter applied
« Reply #35 on: September 20, 2013, 05:42:15 pm »
Hello,

I am not certain the issue has anything at all to do with TSQLQuery or Filtering. I have an application I'm developing which has this very same issue with the scrolling of TDBGrid-based grids and I'm using Zeos DB lib and no filtering at all.

(See my post here: http://forum.lazarus.freepascal.org/index.php/topic,22093.0.html)

In contrast, I have also experimented with TKDBGrid and do not experience the problem _at all_.

In reading through the various comments here, I can see how a disconnect between the dataset and the grid (with respect to row count) could be an issue, but I don't think it is necessarily related to the specific components which have been identified, but rather to the grids themselves. Although the issue could certainly be exacerbated through lack of proper communication of the row counts for sure.

Has there been any progress made on this front? Is there any place else that I could go to get more information on the issue?


Thanks,

John Whitten
Some programmers seem Blaise about Pascal...

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: DBGrid error on scrolling, after SQLQuery filter applied
« Reply #36 on: September 21, 2013, 02:15:34 am »
@jwhitten: 
To be clear:  Are you saying that you are reproducing the "SQLQueryMain : Could not find the requested record" issue outside of the TSQLQuery.Filter/TDBGrid combo, or are you just commenting on the TDBGrid Scrollbar issues?

This Topic has been muddied over time (mainly by me :(), but should be focused on the "SQLQueryMain : Could not find the requested record" issue.

I'll reply to your TDBGrid Scrollbar issues over in your Topic :)  Very glad you raised them in a different topic, as that helps differentiate the two issues...


UDPATE:
Quote
Has there been any progress made on this front? Is there any place else that I could go to get more information on the issue?

On the "SQLQueryMain : Could not find the requested record" issue?  Progress was delayed for a year by me forgetting to post a sample app.  I've now posted this, and added a BugReport.  No news yet, other than your addition.  Many thanks for that, I agree with your assessment.

On the wonky DBGrid scrollbar issue?  It's not officially a bug.  I've explained in your Topic, and offered the workaround I use...
« Last Edit: September 21, 2013, 03:46:35 am by Mike.Cornflake »
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: DBGrid error on scrolling, after SQLQuery filter applied
« Reply #37 on: September 23, 2013, 11:01:38 am »
Can you please check your version of dbgrids.pas ?
When I use your test application in bug report I can reproduce bug with your EXE byt I cann't reproduce when I recompile application.

Please look in dbgrids.pas at method: TCustomDBGrid.WMVScroll
Do you see there:
Code: [Select]
IsSeq := FDatalink.DataSet.IsSequenced and not FDataLink.DataSet.Filtered; and then
Code: [Select]
else if IsSeq then
      FDatalink.DataSet.RecNo := aPos + 1
So for filtered dataset RecNo should be never called ...

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: DBGrid error on scrolling, after SQLQuery filter applied
« Reply #38 on: September 24, 2013, 01:58:41 am »
I can confirm in Lazarus DBGrid 1.0.8, line 1208 says
Code: [Select]
IsSeq := FDatalink.DataSet.IsSequencedand the bug reproduces.

I can confirm that in Lazarus 1.1.99 line 1268 (obviously lots of other changes have occurred as well)
Code: [Select]
IsSeq := FDatalink.DataSet.IsSequenced and not FDataLink.DataSet.Filtered;and I cannot reproduce the bug.

While there is no exception raised, there is now a new minor nusiance.  You cannot effectively drag the scrollbar thumb to locate within a filtered a dataset.  The moment you do, you are taken directly to the last record.  All the other scrollbar behaviour works as expected.

So, the serious bug is fixed, and a minor UI nuisance has replaced it.  Definitely progress in the right direction.  I'll see about getting the bug tracker issue closed, and I'll raise a new one for the much more minor UI issue.

Many thanks.

UPDATE:

:-(  This was fixed back in October 2012!!  I could have sworn I checked this in 1.0.12 :-(   Sorry for wasting your time.

I have requested that the bug be closed.  I don't seem to have permission to do so.

UPDATE to UPDATE:  Oh, I think I see.  I'm guessing bug fix not back-ported to the 1.0.x series.  I should have done my testing with SVN latest :-(  Again, apologies...
« Last Edit: September 24, 2013, 03:33:07 am by Mike.Cornflake »
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: DBGrid error on scrolling, after SQLQuery filter applied
« Reply #39 on: September 24, 2013, 07:29:55 am »
While there is no exception raised, there is now a new minor nusiance.  You cannot effectively drag the scrollbar thumb to locate within a filtered a dataset.  The moment you do, you are taken directly to the last record.

Yes I also noticed this strange behavior  ::)

UPDATE to UPDATE:  Oh, I think I see.  I'm guessing bug fix not back-ported to the 1.0.x series.  I should have done my testing with SVN latest :-(  Again, apologies...

You can request backporting in Lazarus: http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch#Submitted_by_developer_.2F_committer

 

TinyPortal © 2005-2018