Subject | DSQL doesn´t, CURSOR does twice: stored procedures |
---|---|
Author | hannes hernler |
Post date | 2001-10-17T17:07:13Z |
I´ve got a funny phenomenon:
I have a stored procedure in my database and tested
various IBO components by calling this SP.
------------
if not dsqlNewItem.Prepared then
dsqlNewItem.Prepare;
dsqlNewItem.ParamByName('POMAGID').asinteger := Info['OMag'];
dsqlNewItem.ParamByName('PIPARENT').asinteger := Info['Parent'];
dsqlNewItem.Execute;
result:= dsqlNewItem.fieldbyname('RID').asinteger;
-------------
the DSQL query is always the same:
SELECT RID FROM SP_OMITEM_NEW( ?POMAGID, ?PIPARENT )
------------
in the SP a generator is called and an row inserted in a table.
the generated value is returned.
when I use a TIB_Cursor, the procedure is called twice.
when I use TIB_DSQL it works one time in the context above
and from then on reurns the same RID every time (and no
row is inserted)
when I use TIB_StoredProcedure everything works fine.
ok, I go and use TIB_StoredProcedure .
but in IBO help is written that it should make no difference...
hannes hernler
--------------------------------------------------------
DWS - Delphi Web Script
developing professional web apps
look at http://www.dwscript.com
--------------------------------------------------------
I have a stored procedure in my database and tested
various IBO components by calling this SP.
------------
if not dsqlNewItem.Prepared then
dsqlNewItem.Prepare;
dsqlNewItem.ParamByName('POMAGID').asinteger := Info['OMag'];
dsqlNewItem.ParamByName('PIPARENT').asinteger := Info['Parent'];
dsqlNewItem.Execute;
result:= dsqlNewItem.fieldbyname('RID').asinteger;
-------------
the DSQL query is always the same:
SELECT RID FROM SP_OMITEM_NEW( ?POMAGID, ?PIPARENT )
------------
in the SP a generator is called and an row inserted in a table.
the generated value is returned.
when I use a TIB_Cursor, the procedure is called twice.
when I use TIB_DSQL it works one time in the context above
and from then on reurns the same RID every time (and no
row is inserted)
when I use TIB_StoredProcedure everything works fine.
ok, I go and use TIB_StoredProcedure .
but in IBO help is written that it should make no difference...
hannes hernler
--------------------------------------------------------
DWS - Delphi Web Script
developing professional web apps
look at http://www.dwscript.com
--------------------------------------------------------