Delete Operation
Instances of RWDBCursor can also be used to delete rows from a table. This use is an encapsulation of the SQL statement:
 
DELETE tableName WHERE CURRENT OF cursorName
The following example allows users to delete names from a table:
 
RWDBConnection conn = aDatabase.connection();
RWDBTable customers = aDatabase.table("customer");
RWDBSelector aSelector = aDatabase.selector();
aSelector << customers["name"];
conn.beginTransaction();
RWDBCursor aCursor =
aSelector.cursor(conn, RWDBCursor::Sequential, RWDBCursor::Write);
RWCString customerName;
aCursor << &customerName;
while (aCursor.fetchRow().isValid()) {
std::cout << "Delete " << customerName << " (Y or N)? ";
char answer;
std::cin >> answer;
if (answer == 'y' || answer == 'Y')
aCursor.deleteRow(customers.name());
}
conn.commitTransaction();