Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

4.9 Deleting Data

Class RWDBDeleter is used to delete rows from database tables. A deleter is obtained by requesting one from a database table, and it may be supplied with an RWDBCriterion to express a restriction on the rows to be deleted. You can express a restriction through a where() method, just as with RWDBSelector and RWDBUpdater. The structure should be familiar by now:

This example is equivalent to an SQL statement of this type:

It is executed on //2, deleting the rows in the purchase table whose videoID column contains the value 1234. As with RWDBUpdater, the where() call on //2 is important. Omitting it would have caused all rows in the purchase table to be deleted. Executing a deleter without calling the where() method, which assigns a criterion, causes all rows within the table to be deleted.


NOTE: Executing a deleter without first assigning a criterion causes all rows of the table to be deleted.

As with an updater, once a criterion has been assigned to a deleter using the where() method, that criterion is retained. The where() method can be called at anytime to set a new criterion, or it can be called with an empty criterion to clear the criterion. The considerations regarding results and connections for RWDBInserter and RWDBUpdater apply equally to RWDBDeleter.


Previous fileTop of DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.