udcurscnt

Return the number of open database cursors

short udcurscnt(uc, drvnum, delta)

struct uctrl *uc;

short drvnum, delta;

Parameters

  • uc—address of the current control block.
  • drvnum—connector number (available in uctrl->udrvnum).
  • delta—number of cursors that have been opened (delta > 0) or closed (delta < 0).

Return Values

The new total number of open database cursors.

Description

udcurscnt returns the total number of open database cursors, which informs Uniface that the number of open database cursors has changed. If the connector opens or closes one or more database cursors, it must call udcurscnt within the execution of the same connector request.

This example closes a cursor and adjusts the cursor count. Error checking is not performed.

CloseCursor ( struct uctrl *ControlBlock, CursorIdType CursorId )
{
char *Cursor = CursorName ( CursorId );
EXEC SQL CLOSE :Cursor; /* This depends on the API of your DBMS. */
if ( Success() )
{
udcurscnt ( ControlBlock, ControlBlock->udrvnum, -1 );
/* Possibly perform some administrative actions on CursorId. */
}
else
{
/* Some actions to process the error. */
}
}