Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWDBOSql



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

Synopsis

#include <rw/db/osql.h>

Description

Class RWDBOSql is an encapsulation of a database-specific SQL statement with all its input and output bindings. Program variables may be bound to placeholders in your statement using operator <<, and shifting in RWDBAbstractBuffers, such as RWDBTBuffers, which describe input data. Class RWDBOSql also contains a vector of RWDBMultiRows, each of which specifies the output bindings for a single result set. You can use the RWDBOSql operator[] to obtain a reference to an RWDBMultiRow, and then use the RWDBMultiRow operator>> to provide output bindings for the RWDBMultiRow.

When executing an RWDBOSql that produces results, there are two options for specifying the output RWDBAbstractBuffers for those results:

RWDBOSql is designed around the Interface/Implementation paradigm. An RWDBInserter instance is an interface to a reference-counted implementation; copy constructors and assignment operators produce additional references to a shared implementation.

Example 1

In this example, we use an RWDBOSql to execute a query with a placeholder. The input value and output storage are both specified using RWDBTBuffer. Please note that Oracle-specific placeholder syntax is used here; check your access library guide or vendor documentation for appropriate SQL and placeholder syntax.

Example 2

In this example, we use an RWDBOSql to execute a user-supplied ad hoc query. We then use an RWDBMultiRow to fetch the results.

Public Enums

enum StatementType { NonQuery = 0, Query, Procedure };

Public Constructors

RWDBOSql();
RWDBOSql(const RWCString & sql, 
         StatementType type = NonQuery);
RWDBOSql(const RWDBOSql& osql);

Public Destructor

~RWDBOSql();

Public Member Operators

RWDBOSql& 
operator=(const RWDBOSql& osql);
RWDBOSql&
operator<<(RWDBAbstractBuffer& input);
RWDBMultiRow& 
operator[](size_t index);

Public Member Functions

RWDBOSql& 
cancel(CancelType tp);

NOTE:This call is only valid after the RWDBOSql is executed. Calling cancel() before execute() invalidates the RWDBOSql, setting an RWDBStatus::invalidUsage error, and calling any associated error handler.
RWDBStatus::errorHandler 
errorHandler() const;
void
execute(RWDBConnection& cn, size_t blkSz=0);
RWDBOSql&
fetch();

NOTE:This call is only valid after the RWDBOSql is executed. Calling fetch() before execute() invalidates the RWDBOSql, setting an RWDBStatus::invalidUsage error, and calling any associated error handler.
RWDBOSql& 
fetchReturnParams();
RWBoolean
hasResult() const; 
RWBoolean
isReady() const;
RWBoolean
isValid() const;
RWDBValue 
returnValue() const;
long 
rowCount() const;
long 
rowsFetched() const;
RWDBSchema
schema() const;
void 
setErrorHandler(RWDBStatus::ErrorHandler err);
RWCString
statement() const;
RWDBOSql& 
statement(const RWCString& sql, 
          StatementType type = NonQuery); 
RWDBStatus 
status() const;
StatementType 
type() const;


Previous fileTop of DocumentContentsIndexNext file

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