Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWDBDeleter



Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <rw/db/deleter.h>

RWDBDeleter deleter = myTable.deleter();

Description

RWDBDeleter is an encapsulation of an SQL DELETE statement.

The where() method of RWDBDeleter is used to specify a WHERE clause. The WHERE clause is encapsulated by an RWDBCriterion, which is some number of RWDBExprs combined with logical operators.

A DELETE statement does not normally produce results. However, DBTools.h++ recognizes that some database vendors provide triggers, which can cause results to be generated by a DELETE statement. Consequently, the execute() method of RWDBDeleter returns an RWDBResult, which is a sequence of zero or more RWDBTables. Applications are not obliged to request any tables from the returned object.

RWDBDeleter is designed around the Interface/Implementation paradigm. An RWDBDeleter instance is an interface to a reference-counted implementation; copy constructors and assignment operators produce additional references to a shared implementation. An RWDBDeleter implementation is a base class from which a family of database-specific deleter implementations is derived.

Example 1

For this example, we delete all the red hubcaps from the autoParts table:

Example 2

For this example, we delete all parts with a specific id by repeatedly using binding to a variable containing the id:

Related Classes

The encapsulated WHERE clause of an RWDBDeleter is an RWDBCriterion, which is composed of RWDBExprs. See RWDBCriterion, RWDBExpr, and RWDBColumn for details.

The result of execute() is an RWDBResult, which represents a sequence of zero or more RWDBTables. See RWDBResult and RWDBTable for details.

Public Constructors

RWDBDeleter();
RWDBDeleter(const RWDBDeleter& deleter);

Public Member Operator

RWDBDeleter&
operator=(const RWDBDeleter& deleter);

Public Member Functions

void
acquire() const;
RWCString
asString() const;
void
clear();
RWDBStatus::ErrorHandler
errorHandler() const;
RWDBResult
execute();
RWDBResult
execute(const RWDBConnection& connection);
RWBoolean
isReady() const;
RWBoolean
isValid() const;
void
release() const;
void
setErrorHandler(RWDBStatus::ErrorHandler handler);
RWDBStatus
status() const;
RWDBTable
table() const;
RWDBCriterion
where() const;
RWDBDeleter&
where(const RWDBCriterion& criterion);


Previous fileTop of DocumentContentsIndexNext file

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