Subject AW: [IBO] DSQL Executing
Author Kaputnik
See below for comments...

CU, Kaputnik
(Nick Josipovic)

nick@... <mailto:nick@...>
kap@... <mailto:kap@...>
--------------------------------------------------------------
superior Client/Server programming:
www.IBObjects.com <http://www.IBObjects.com>
a nice tool for Interbase:
www.InterbaseWorkbench.com <http://www.InterbaseWorkbench.com>



> -----Ursprüngliche Nachricht-----
> Von: Yagi [mailto:yagi@...]
> Gesendet: Donnerstag, 1. März 2001 13:03
> An: IBObjects
> Betreff: [IBO] DSQL Executing
>
>
> Hi,
>
> I have two questions.
>
> 1.
>
> I use TIB_DSQL with te following statement:
....
> now, if SELECT statement returns no records (adres parameter is
> wrong) then
> i got an error on ibdsqlCM.Execute():
>
> ISC ERROR CODE:335544374
>
> ISC ERROR MESSAGE:
> attempt to fetch past the last record in a record stream
>
> Am I doing something wrong?
>

For select-statements, it would be better to use an IB_Cursor. AFAIK, the
DSQL-component is of use only for singelton-selects and stements without
result-set at all. IB_Cursor should be as fast as the DSQL-component, and
will make you less headaches. Use DSQL for updates, DDL and so on..

> 2.
>
> I set Prepared = true for TIB_DSQL or TIB_StoredProc before
> setting params.
> Shuld I set Prepared=false after Execute() if i'm going to use another
> parameters value and exec the statement again?
>

There is a bug in IB that lets Stored procs getting ut of synch on the
server, so in an SP, you should reprepare always. Otherwise, it is not
necessary at all to reprepare. Once, the server parses the statement, and
IBO gets the server-parameter, you can overwrite the params as often as you
like and execute again. Reprepüaring will cost you only time for having the
optimizer running again and again.