🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
2 messages
2 total messages Started by Jorge Leibowich Mon, 05 Feb 2001 12:36
TQuery->Prepare()
#5758
Author: Jorge Leibowich
Date: Mon, 05 Feb 2001 12:36
3 lines
1023 bytes
I read the help, and says that if a put Prepare() method, when I execute the
same query a lot of times, I'm optimizing the program... but... When I use
the same query? NEVER!! I dont understand it.....
Re: TQuery->Prepare()
#5759
Author: Anatolix
Date: Mon, 05 Feb 2001 16:03
27 lines
1721 bytes
Jorge Leibowich <jorge@lid.com.ar> ������� � ��������
���������:3a7e9e7e_1@dnews...
> I read the help, and says that if a put Prepare() method, when I execute
the
> same query a lot of times, I'm optimizing the program... but... When I use
> the same query? NEVER!! I dont understand it.....

For example yo need insert 100000 rows in table
you do:
(Code is for bde not ado)
Query->SQL->Text="insert into qwe(asd,zxc) values :asd,:zxc"
Query->Prepare();
for (...100000)
{
   Query->ParamByName("asd")->AsInteger=i;
   Query->ParamByName("zxc")->AsString="...";
   Query->ExecSQL();
}
Query->UnPrepare();

in these case
1) Query Text Will be Parsed 1 time
2) Optimizer will run once, because plan of all sql are same.
3) Only param values(not sql text) go to server 100000 times

it speed up insertion greately.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads