Filters. What is more efficient and quick

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ziclope
Posts: 27
Joined: Fri 24 Feb 2006 11:34

Filters. What is more efficient and quick

Post by ziclope » Tue 11 Apr 2006 17:22

Hello,

I would like know what is the best method for filter in Query statement.
I dont know how filter and filtered properties are working.

What is the 2 (any more ? :) ways is more quick:

1.- Way: use filter property

MyQuery->Close();

MyQuery->Filter = Key + " = " + Value;
MyQuery->Filtered = true;

MyQuery->Open();

2.- Way: Rewrite the SQL query.

MyQuery->Close();

MyQuery->SQL->Text = "SELECT * FROM mytable WHERE Key = Value";

MyQuery->Open();

Regards

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Tue 11 Apr 2006 21:01

Writing SQL sentence is best performance

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 12 Apr 2006 08:50

Both ways to filter recordset ziclope has offered are dependent on various conditionals. So you should test these ways yourself in your situation to choose the best.

Post Reply