Instantiating an RWDBCursor
Instances of
RWDBCursor are created in much the same manner as
RWDBSelector instances. The
cursor() member function of the
RWDBDatabase class produces an instance of
RWDBCursor. There are also
cursor() member functions for
RWDBTable and
RWDBSelector, each forwarding the actual creation of the cursor to its associated database. Only
RWDBTable instances representing database tables or derived tables produce usable
RWDBCursor instances. In particular,
RWDBMemTable and
RWDBTPtrMemTable produce invalid cursors. The following lines create
RWDBCursor instances:
RWDBCursor cursor1 = aDatabase.cursor(aSelector);
RWDBCursor cursor2 = aTable.cursor();
RWDBCursor cursor3 = aSelector.cursor();
Cursors can also be created with alternative access attributes. Some databases support scrollable cursors. These cursors need not access data linearly; they can jump around. Scrollable cursors are created with the special flag RWDBCursor::Scrolling.
RWDBCursor cursor3 = aSelector.cursor(RWDBCursor::Scrolling);