Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWDBResult



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

Synopsis

#include <rw/db/result.h>

RWDBResult result = myConn.executeSql("someSql");
RWDBResult result = mySelector.execute();
RWDBResult result = myInserter.execute();
RWDBResult result = myDeleter.execute();
RWDBResult result = myUpdater.execute();
RWDBResult result = myStoredProcedure.execute();

Description

RWDBResult represents a sequence of zero or more RWDBTables. An RWDBResult instance is returned whenever a database operation may potentially produce multiple SQL table expressions. This is most obviously the case when using the RWDBDatabase::executeSql() method to submit arbitrary SQL for execution. However, DBTools.h++ recognizes that some database vendors provide:

For this reason, each of the above execute() methods returns an RWDBResult instance. An application that knows that its database does not provide these capabilities is not obliged to check for multiple results.

Every RWDBResult instance has an RWDBConnection. Passing an RWDBConnection to an execute() method causes the RWDBResult to acquire the passed connection. Calling execute() without an RWDBConnection causes the RWDBResult to acquire a default connection from the caller's RWDBDatabase. In each case, the connection is held by the RWDBResult until the RWDBResult is destroyed.

The RWDBTables produced by RWDBResult must be processed in order. Each call to RWDBResult::table() causes unprocessed rows from any previous table to be flushed.

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

Example

Here is a way to process an SQL query that may return more than one table expression. The example assumes that the SQL is contained in the variable sqlString.

Public Constructors

RWDBResult();
RWDBResult(const RWDBResult& result);

Public Member Operator

RWDBResult&
operator=(const RWDBResult& result);

Public Member Functions

RWDBConnection
connection() const;
RWDBStatus::ErrorHandler
errorHandler() const;
RWBoolean
isReady() const;
RWBoolean
isValid() const;
long
rowCount() const;

NOTE:Because of differences in implementations, it may be necessary to call the table() method before determining the row count.
void
setErrorHandler(RWDBStatus::ErrorHandler handler);
RWDBStatus
status() const;
RWDBTable
table();


Previous fileTop of DocumentContentsIndexNext file

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