Article View: borland.public.cppbuilder.database.ado
Article #5759Re: TQuery->Prepare()
From: Anatolix
Date: Mon, 05 Feb 2001 16:03
Date: Mon, 05 Feb 2001 16:03
27 lines
1721 bytes
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.
Technical Details
Message-ID:
<3a7ecee0_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!grolier!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!195.38.37.43References:
<3a7e9e7e_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,b20ab8aae57d7247 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-02-05 08:04:22 PST From: "Anatolix" <Anatolix@narod.ru> Newsgroups: borland.public.cppbuilder.database.ado References: <3a7e9e7e_1@dnews> Subject: Re: TQuery->Prepare() Date: Mon, 5 Feb 2001 21:03:16 +0500 Lines: 29 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2417.2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: 195.38.37.43 Message-ID: <3a7ecee0_1@dnews> X-Trace: 5 Feb 2001 08:03:44 -0800, 195.38.37.43 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!grolier!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!195.38.37.43