Recent

Author Topic: Locate error  (Read 2081 times)

mmelwin

  • New Member
  • *
  • Posts: 23
Locate error
« on: June 18, 2021, 07:59:17 am »
I also put it here because I think the problem is with SQLQuery and not with DbGrid.

When I click on DBGrid while running a Locate on SQLQuery, the DBGrid crashes. Can I prevent this somehow? Disable / EnableControls doesn't help. I am attaching two screenshots, before and after Locate.

Lazarus 2.0.12, FPC 3.2.0, OS Win10, PostgreSQL 13

In demo:
Please click "Populate", wait a while, click "Locate" and quickly click in the DBGrid area.
The problem only occurs when the searched field is sorted descending.
For ease of use, the demo uses SQLite.

Oryginal post: https://forum.lazarus.freepascal.org/index.php/topic,54966.0.html

Soner

  • Full Member
  • ***
  • Posts: 240
Re: Locate error
« Reply #1 on: June 18, 2021, 08:30:22 am »
I tested with lazarus 2.0.11 fpc 3.2.1 both 64 bit and Lazarus 1.8.5 with fpc 3.0.4 32bit on Windows 10.
I could not reproduce the error, from original post too.

Have your computer enough ram? Your program consums 423 MB RAM. Without enough free RAM swapping and locate can take a long time.
For me it looks like speed problem caused by ram on your computer wait at least 1 minute after clicking locate.

Try this, maybe it helps:
Code: Pascal  [Select][+][-]
  1. DBGrid1.BeginUpdate;
  2.  try
  3.   SQLQuery1.Locate('test', 200000, []);
  4.  finally
  5.   DBGrid1.EndUpdate(false);
  6.  end;
  7.  

mmelwin

  • New Member
  • *
  • Posts: 23
Re: Locate error
« Reply #2 on: June 18, 2021, 08:49:15 am »
I think I've found the problem. Out of memory.
Everything is fine after compiling to x64.
I just need to find some other solution, because I have several computers with Win XP 32bit :(

Zvoni

  • Hero Member
  • *****
  • Posts: 627
Re: Locate error
« Reply #3 on: June 18, 2021, 01:45:18 pm »
Release/Free Memory you don't need
One System to rule them all, One IDE to find them,
One Code to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
People call me crazy, because i'm jumping out of perfectly fine aircraft

 

TinyPortal © 2005-2018