Programming Guide : Working with a Database : How Programming for Multiple Sessions Works : How You Can Use Cursors, DataStream Objects, and Multiple Sessions
 
Share this page          
How You Can Use Cursors, DataStream Objects, and Multiple Sessions
Every cursor or DataStream object opened in QY_CURSOR mode has an associated CursorObject object. One of the attributes of the CursorObject system class is DBSession. This attribute contains a DBSessionObject, which identifies the database session in which the cursor or DataStream object was opened.
After you open a CursorObject object, OpenROAD uses the session associated with the DBSessionObject object in the CursorObject's DBSession attribute for any subsequent cursor statements.
Therefore, when you issue a fetch, update, delete, or close cursor statement, or a FetchRow, DBInsert, DBUpdate, DBDelete or Close method on a DataStream object, the specified operation takes place in the session in which the cursor was opened, regardless of the session in which the frame is running.
It is not necessary to switch explicitly to the session with which the CursorObject object is associated to perform a cursor operation. After the cursor statement completes, OpenROAD automatically returns to the session in which the frame was working before the cursor statement.