What's more Fast???

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

What's more Fast???

Post by eduardosic » Tue 11 Apr 2006 07:59

What's is more Fast??,in execution

example 1:

with QueryClients do begin
Close;
SQL.Clear;
SQL.Add( 'Select Name From Clients ' );
SQL.Add( 'Where name like ' + '''' + edit1.text + '%' + '''' );
Prepare;
Open;
end;

example 2:

with QueryClients do begin
Close;
SQL.Clear;
SQL.Add( 'Select Name From Clients ' );
SQL.Add( 'Where name like :pParam' );
ParamByName( 'pParam' ).AsString := Edit1.Text + '%';
Prepare;
Open;

end;


which the execution form fastest??

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by swierzbicki » Tue 11 Apr 2006 09:18

Both are the same since this is related to Delphi and not MySQL

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

Post by Antaeus » Tue 11 Apr 2006 11:25

The performance is the same in both cases. But using parameters is more correct.

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

thanks

Post by eduardosic » Tue 11 Apr 2006 21:53

Antaeus wrote:The performance is the same in both cases. But using parameters is more correct.
thanks all.

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Thu 27 Apr 2006 20:20

why you dont do a JOIN to other table to get all the relative records instead of opening/closing table inside a loop?

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

Post by GEswin » Thu 27 Apr 2006 21:55

ben, afaik he isn't using any loop

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Fri 28 Apr 2006 08:36

oops I thought it was "while" not with
Sorry

Post Reply