🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
4 messages
4 total messages Started by Jorge Leibowich Tue, 06 Mar 2001 16:41
Preparing querys..... but with select statements
#5667
Author: Jorge Leibowich
Date: Tue, 06 Mar 2001 16:41
23 lines
1828 bytes
I'm want to do an applicattion that do about 10000 SELECTS, NOT INSERTS.

I'm tested with parametrized querys with "Insert" and it is very faster.
But i have a problem with SELECTS.... for example, this works WELL

Query->SQL->Text="insert into qwe(field,zxc) values :asd,:zxc"
Query->Prepare();
for (...100000)
{
   Query->ParamByName("field")->AsInteger=i;
   Query->ParamByName("zxc")->AsString="...";
   Query->ExecSQL();
}
Query->UnPrepare();

BUT... If a put the same replacing the text in "select from table where
field = :field"
and replacing Query->ExecSQL(); to Query->Open(); I do NOT get the correct
RESULT. I'm Getting always the same result, and it is not correct. The
QUESTION: The prepare method dont works in
Query->Open() method? Only works in ExecSQL ???

THANK YOU
Re: Preparing querys..... but with select statements
#5675
Author: Neo
Date: Wed, 07 Mar 2001 15:41
31 lines
2014 bytes
Use Query->SQL->Clear();
then
Query->SQL->Add(sql string);
then
Query->Open();
Jorge Leibowich <jorge@lid.com.ar> wrote in message news:3aa5134d_1@dnews...
> I'm want to do an applicattion that do about 10000 SELECTS, NOT INSERTS.
>
> I'm tested with parametrized querys with "Insert" and it is very faster.
> But i have a problem with SELECTS.... for example, this works WELL
>
> Query->SQL->Text="insert into qwe(field,zxc) values :asd,:zxc"
> Query->Prepare();
> for (...100000)
> {
>    Query->ParamByName("field")->AsInteger=i;
>    Query->ParamByName("zxc")->AsString="...";
>    Query->ExecSQL();
> }
> Query->UnPrepare();
>
> BUT... If a put the same replacing the text in "select from table where
> field = :field"
> and replacing Query->ExecSQL(); to Query->Open(); I do NOT get the correct
> RESULT. I'm Getting always the same result, and it is not correct. The
> QUESTION: The prepare method dont works in
> Query->Open() method? Only works in ExecSQL ???
>
> THANK YOU
>
>
Re: Preparing querys..... but with select statements
#5676
Author: Jorge Leibowich
Date: Wed, 07 Mar 2001 17:12
40 lines
2252 bytes
But is very slow!!! I'm changing the sql text every time query that i
do!!!!!

"Neo" <klink_stalag13@nospam_yahoo.com> wrote in message
news:3aa6578a_2@dnews...
> Use Query->SQL->Clear();
> then
> Query->SQL->Add(sql string);
> then
> Query->Open();
> Jorge Leibowich <jorge@lid.com.ar> wrote in message
news:3aa5134d_1@dnews...
> > I'm want to do an applicattion that do about 10000 SELECTS, NOT INSERTS.
> >
> > I'm tested with parametrized querys with "Insert" and it is very faster.
> > But i have a problem with SELECTS.... for example, this works WELL
> >
> > Query->SQL->Text="insert into qwe(field,zxc) values :asd,:zxc"
> > Query->Prepare();
> > for (...100000)
> > {
> >    Query->ParamByName("field")->AsInteger=i;
> >    Query->ParamByName("zxc")->AsString="...";
> >    Query->ExecSQL();
> > }
> > Query->UnPrepare();
> >
> > BUT... If a put the same replacing the text in "select from table where
> > field = :field"
> > and replacing Query->ExecSQL(); to Query->Open(); I do NOT get the
correct
> > RESULT. I'm Getting always the same result, and it is not correct. The
> > QUESTION: The prepare method dont works in
> > Query->Open() method? Only works in ExecSQL ???
> >
> > THANK YOU
> >
> >
>
>
Re: Preparing querys..... but with select statements
#5648
Author: David B. Held
Date: Mon, 26 Mar 2001 20:52
25 lines
1887 bytes
Jorge Leibowich wrote in message <3aa5134d_1@dnews>...
[snip]
>Query->SQL->Text="insert into qwe(field,zxc) values :asd,:zxc"
>Query->Prepare();
>for (...100000)
>{
>   Query->ParamByName("field")->AsInteger=i;
>   Query->ParamByName("zxc")->AsString="...";
>   Query->ExecSQL();
>}
>Query->UnPrepare();
>
>BUT... If a put the same replacing the text in "select from table where
>field = :field"
>and replacing Query->ExecSQL(); to Query->Open(); I do NOT get the correct
>RESULT. I'm Getting always the same result, and it is not correct. The
>QUESTION: The prepare method dont works in
>Query->Open() method? Only works in ExecSQL ???

Why exactly do you need to do 100000 SELECTs?  Why not open the
table directly, with a TTable object, and select a Range (if field is not
unique), or use GotoKey (if field is unique)?  Then you don't need to parse
the SQL 100,000 times or access the db 100,000 times.

Dave
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