The DBTools.h++ RWDBCursor class for Oracle is implemented using a row-by-row fetch. The phrase for update is appended to the RWDBSelector or SQL statement when the cursor is constructed with access = RWDBCursor::Write; therefore rows selected will have exclusive locks. The use of cursors is subject to many restrictions:
Cursors are not directly supported by the OCI library, and therefore the same restrictions that apply to the OCI pre-compiler cursors apply to RWDBCursor. The most restrictive is that positioned updates or deletes can only be made to cursors created from a single table. Cursors created with a join of two tables will not be able to perform positioned updates or deletes.
Oracle cursors are not scrollable; the only type of fetch supported is RWDBCursor::fetchNext. Other types of fetch will result in an RWDBStatus::notSupported error.
Positioned deletes, inserts, and updates are implemented by constructing the appropriate SQL statement and executing the SQL statement using a second CDA (cursor data area). The RWDBCursor should be in transaction mode. Here is an example:
Conn.beginTransaction(); RWDBCursor csr= select.cursor( ..., Conn, RWDBCursor::Write); int bd; csr << &bd; while ( csr.fetchRow().isValid() ) { ... csr.updateRow(...); } Conn.commitTransaction();
Positioned inserts do not require the application to provide data for all columns in the table. Previously fetched values will be used for columns not provided by the application.
©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.