Subject "Statement has already assigned 1 cursor" error - The fix
Author m. Th.
Hi,

The bug "Statement has already one cursor assigned error." - SF ID: 2789922

http://sourceforge.net/tracker/?func=detail&aid=2789922&group_id=256127&atid=1126933

still exists in 4.9.3. However I found a fix for it:

In IB_Components.Pas we have

function TIB_BDataset.SysLookupKeyForBufferFields(
ANodeRef: TIB_NodeRef ):
boolean;
...

errcode := isc_dsql_set_cursor_name( @status,
@FSeekCursor,

pbyte(IntToStr(cardinal(FSeekCursor))
+
CursorName ),
0 );
...

the above isc_dsql_set_cursor_name call is around of line no 34625 (but
is possible to be different in your sources).

The problem is that (at least) IntToStr returns an Unicode string which
can have #0. So we must change to:

cName:=IntToStr(cardinal(FSeekCursor))+ CursorName;

errcode := isc_dsql_set_cursor_name( @status,
@FSeekCursor,
pbyte(cName),
0 );


...where cName is a local AnsiString (IOW cName: AnsiString)


There are other bugs in TDataSet-compatible (TIBO) layer but I cannot
(for the time being) do a simple test case for them.

HTH,

m. Th.