Lazarus

Programming => Databases => Topic started by: mmelwin on June 18, 2021, 07:59:17 am

Title: Locate error
Post by: mmelwin 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
Title: Re: Locate error
Post by: Soner 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.  
Title: Re: Locate error
Post by: mmelwin 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 :(
Title: Re: Locate error
Post by: Zvoni on June 18, 2021, 01:45:18 pm
Release/Free Memory you don't need
TinyPortal © 2005-2018