Subject RE: [IBO] Cursors
Author Malcolm Smith
I tried only preparing once but got an exception - I had to close and
re-open (via Prepare)

I also wrote I was gathering data for an in-memory structure - I'm only
collecting data, not updating records.


Malcolm Smith
MJ Freelancing
http://www.mjfreelancing.com
C++Builder Software Protection


-----Original Message-----
From: Svein Erling Tysvaer
[mailto:svein.erling.tysvaer@...]
Sent: Monday, 9 September 2002 23:11
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] Cursors


Hi Malcolm,

>My question is whether this is the most efficient method (required to
>prepare/close on each iteration).

No, it isn't. You could save quite a bit if you just skipped preparing for
each iteration, but best of all would be to just do it all in one go:

UPDATE <DBSpriteDetail>
SET <IPAddress> = (SELECT IPL_IPADDRESS FROM IPLOOKUP WHERE IPLOOKUP.ID =
<DBSpriteDetail.IPLookupID>),
<Local> = (SELECT IPL_LOCAL FROM IPLOOKUP WHERE IPLOOKUP.ID =
<DBSpriteDetail.IPLookupID>)
WHERE EXISTS (SELECT 1 FROM IPLOOKUP WHERE IPLOOKUP.ID =
<DBSpriteDetail.IPLookupID>)

and please make sure you do it on a test database first, 'cause I don't
want any blame if I wrote something wrong here.

HTH,
Set



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/