SourcePro® API Reference Guide

 
List of all members | Public Types | Public Member Functions
RWDBStoredProc Class Reference

Encapsulates a database stored procedure, providing a uniform API to the common operations related to them. More...

#include <rw/db/stored.h>

Public Types

enum  CacheType { Local, All }
 

Public Member Functions

 RWDBStoredProc ()
 
 RWDBStoredProc (const RWDBStoredProc &proc)
 
void acquire () const
 
RWDBStatus clear ()
 
void clearCache (CacheType cache=RWDBStoredProc::Local)
 
RWDBDatabase database () const
 
RWDBStatus drop ()
 
RWDBStatus drop (const RWDBConnection &connection)
 
RWDBStatus::ErrorHandler errorHandler () const
 
RWDBResult execute ()
 
RWDBResult execute (const RWDBConnection &connection)
 
bool exists (bool forceLookup=false) const
 
bool exists (const RWDBConnection &connection, bool forceLookup=false) const
 
RWDBStatus fetchReturnParams ()
 
bool isNull (const RWDBColumn &column) const
 
bool isNull (const RWCString &name) const
 
bool isNull (size_t index) const
 
bool isReady () const
 
bool isValid () const
 
RWCString name () const
 
RWDBStoredProcoperator<< (RWDBValueManip value)
 
RWDBStoredProcoperator<< (const RWDBValue &value)
 
RWDBStoredProcoperator<< (char value)
 
RWDBStoredProcoperator<< (unsigned char value)
 
RWDBStoredProcoperator<< (short value)
 
RWDBStoredProcoperator<< (unsigned short value)
 
RWDBStoredProcoperator<< (int value)
 
RWDBStoredProcoperator<< (unsigned int value)
 
RWDBStoredProcoperator<< (long value)
 
RWDBStoredProcoperator<< (unsigned long value)
 
RWDBStoredProcoperator<< (long long value)
 
RWDBStoredProcoperator<< (unsigned long long value)
 
RWDBStoredProcoperator<< (float value)
 
RWDBStoredProcoperator<< (double value)
 
RWDBStoredProcoperator<< (long double value)
 
RWDBStoredProcoperator<< (const RWDecimalPortable &value)
 
RWDBStoredProcoperator<< (const RWDate &value)
 
RWDBStoredProcoperator<< (const RWDateTime &value)
 
RWDBStoredProcoperator<< (const RWDBDateTime &value)
 
RWDBStoredProcoperator<< (const RWDBDuration &value)
 
RWDBStoredProcoperator<< (const RWCString &value)
 
RWDBStoredProcoperator<< (const RWDBMBString &value)
 
RWDBStoredProcoperator<< (const RWBasicUString &value)
 
RWDBStoredProcoperator<< (const RWWString &value)
 
RWDBStoredProcoperator<< (const RWDBBlob &value)
 
RWDBStoredProcoperator<< (const RWDBBoundExpr &value)
 
RWDBStoredProcoperator<< (short *valPtr)
 
RWDBStoredProcoperator<< (unsigned short *valPtr)
 
RWDBStoredProcoperator<< (int *valPtr)
 
RWDBStoredProcoperator<< (unsigned int *valPtr)
 
RWDBStoredProcoperator<< (long *valPtr)
 
RWDBStoredProcoperator<< (unsigned long *valPtr)
 
RWDBStoredProcoperator<< (long long *valPtr)
 
RWDBStoredProcoperator<< (unsigned long long *valPtr)
 
RWDBStoredProcoperator<< (float *valPtr)
 
RWDBStoredProcoperator<< (double *valPtr)
 
RWDBStoredProcoperator<< (long double *valPtr)
 
RWDBStoredProcoperator<< (RWDecimalPortable *valPtr)
 
RWDBStoredProcoperator<< (RWDate *valPtr)
 
RWDBStoredProcoperator<< (RWDateTime *valPtr)
 
RWDBStoredProcoperator<< (RWDBDateTime *valPtr)
 
RWDBStoredProcoperator<< (RWDBDuration *valPtr)
 
RWDBStoredProcoperator<< (RWDBBlob *valPtr)
 
RWDBStoredProcoperator<< (RWCString *valPtr)
 
RWDBStoredProcoperator<< (RWDBMBString *valPtr)
 
RWDBStoredProcoperator<< (RWBasicUString *valPtr)
 
RWDBStoredProcoperator<< (RWWString *valPtr)
 
RWDBStoredProcoperator= (const RWDBStoredProc &proc)
 
RWDBStoredProcoperator[] (const RWDBColumn &paramColumn)
 
RWDBStoredProcoperator[] (const RWCString &paramName)
 
RWDBStoredProcoperator[] (size_t index)
 
RWDBSchema params (bool forceLookup=false) const
 
RWDBSchema params (const RWDBConnection &connection, bool forceLookup=false) const
 
size_t position () const
 
void release () const
 
RWDBValue returnValue () const
 
RWDBColumn returnValueColumn () const
 
void setErrorHandler (RWDBStatus::ErrorHandler handler)
 
RWDBStatus status () const
 
RWCString text (bool forceLookup=false) const
 
RWCString text (const RWDBConnection &connection, bool forceLookup=false) const
 

Detailed Description

Many modern RDBMS implementations include a mechanism to enforce database policy through stored procedures. Applications may be required to do much of their data manipulation through stored procedures. Unfortunately, the standards bodies have had little to say about stored procedures, so implementations vary widely among RDBMS vendors. If an RWDBStoredProc feature is not supported by the underlying database, The DB Interface Module reports an RWDBStatus::notSupported error. The remainder of this section assumes that all features are supported. Check the DB Access Module guide for information about what features are supported by a particular database.

RWDBStoredProc is an encapsulation of a database stored procedure. RWDBStoredProc supports creating and deleting stored procedures, retrieving stored procedures definitions, executing stored procedures, and processing results returned from stored procedure execution. Parameters may be passed to an RWDBStoredProc prior to execution, and the values of output parameters may be retrieved. If a database vendor's stored procedure may return multiple sets of results, RWDBStoredProc can access each result set in turn.

RWDBStoredProc uses an RWDBSchema to store information about its formal parameters. Use the insertion operator operator<<() to pass actual parameters to an RWDBStoredProc. Insert values if the stored procedure expects IN parameters; insert pointers if the stored procedure expects OUT or IN/OUT parameters and your application needs to obtain results through the parameters. Insert rwdbNull to pass a literal NULL by value.

Note
It is an error to insert a NULL pointer; if this occurs, the status of the RWDBStoredProc changes to RWDBStatus::nullReference.

RWDBStoredProc maintains a notion of the current position in its parameter list. The current position is set to zero when the RWDBStoredProc is created, and reset to zero whenever the RWDBStoredProc is executed. Each insertion of an actual parameter increments the current position by one. The indexing operator operator[]() can be used to access a particular parameter position by number or by name. Given a stored procedure myStoredProc that expects the parameters number and name in that order, these notations are equivalent:

RWCString hello("Hello World");
myStoredProc << 1 << hello;
myStoredProc[0] << 1;
myStoredProc[1] << hello;
myStoredProc["name"] << hello;
myStoredProc["number"] << 1;

RWDBStoredProc does not check actual parameters for type; it allows the database to do type conversion. If there is a type incompatibility, the DB Interface Module passes along whatever the database reports to the application. The DB Interface Module produces an RWDBStatus::invalidPosition error if too many arguments are inserted into an RWDBStoredProc. No check is made for too few arguments. The database may supply defaults; if not, the DB Interface Module passes along whatever the database reports to the application.

In order to support parameter passing, The DB Interface Module uses a connection to query the database for schema information whenever an RWDBStoredProc is produced by an RWDBDatabase.

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

Synopsis
#include <rw/db/stored.h>
RWDBStoredProc myProc = myDbase.storedProc("myProcName");
Example

In this example, suppose there is a database procedure getId, which expects two parameters: name, an input string representing a customer's name, and id, an output integer parameter representing the customer's id. The procedure is supposed to look up the customer id for the given customer name. If successful, it places the id in its id parameter and returns 0. Otherwise it returns -1 and does not change id.

RWDBStoredProc getId = myDbase.storedProc("getId");
RWCString name("John Doe");
int id;
getId << name << &id;
getId.execute();
RWDBValue retValue = getId.returnValue();
if (retValue.asInt() == 0)
{
cout << "John Doe's id is " << id << endl;
}
else
{
cout << "Can't find John Doe's id" << endl;
}

Member Enumeration Documentation

A class-scoped enum containing the cache types.

Enumerator
Local 

Clears self's cache. Cached data for an RWDBStoredProc consists of the parameter list, the state of the exists flag, and the text.

All 

Clears cached data in self and in the cache manager, if there is one. Cached data for an RWDBStoredProc consists of the parameter list, the state of the exists flag, and the text.

Constructor & Destructor Documentation

RWDBStoredProc::RWDBStoredProc ( )

The default constructor creates an RWDBStoredProc whose status is RWDBStatus::notInitialized. This constructor is provided as a convenience, for example, for declaring an array of RWDBStoredProc objects. Usable RWDBStoredProc objects are obtained from RWDBDatabase instances.

RWDBStoredProc::RWDBStoredProc ( const RWDBStoredProc proc)

Copy constructor. Self shares an implementation with proc.

Member Function Documentation

void RWDBStoredProc::acquire ( ) const

Attempts to acquire the internal mutex lock. If the mutex is already locked by another thread, the function blocks until the mutex is released. This function can be called from a const object.

Note
In single-threaded builds, this function evaluates to a no-op.
RWDBStatus RWDBStoredProc::clear ( )

Clears all internal state.

void RWDBStoredProc::clearCache ( CacheType  cache = RWDBStoredProc::Local)

Clears cached metadata information. If cache is RWDBStoredProc::Local, clears cache in self. If cache is RWDBStoredProc::All, clears cached data in self and in the global cache derived from RWDBCacheManager, if there is one.

RWDBDatabase RWDBStoredProc::database ( ) const

Returns the RWDBDatabase that produced self. Returns an RWDBDatabase whose status is RWDBStatus::notInitialized, if self was created with the default constructor.

RWDBStatus RWDBStoredProc::drop ( )

Uses a default database connection to execute the database-specific equivalent of the SQL statement:

DROP PROCEDURE <name>

where <name> is the name of the database stored procedure encapsulated by self. You can check the isValid() method of the return value to see if the operation succeeded.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

RWDBStatus RWDBStoredProc::drop ( const RWDBConnection connection)

Uses the supplied connection to execute the database-specific equivalent of the SQL statement:

DROP PROCEDURE <name>

where <name> is the name of the database stored procedure encapsulated by self. You can check the isValid() method of the return value to see if the operation succeeded. This function can behave asynchronously if executed using an asynchronous connection.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

RWDBStatus::ErrorHandler RWDBStoredProc::errorHandler ( ) const

Returns the error handler attached to self.

RWDBResult RWDBStoredProc::execute ( )

Uses a default database connection to execute the stored procedure encapsulated by self. The connection is held by the RWDBResult until the RWDBResult is destroyed. The connection is also held by self until either fetchReturnParams() or returnValue() is called, or the RWDBStoredProc is destroyed.

RWDBResult RWDBStoredProc::execute ( const RWDBConnection connection)

Uses the supplied connection to execute the stored procedure encapsulated by self. The connection is held by the RWDBResult until the RWDBResult is destroyed. The connection is also held by self until either fetchReturnParams() or returnValue() is called, or the RWDBStoredProc is destroyed. This function can behave asynchronously if executed using an asynchronous connection.

bool RWDBStoredProc::exists ( bool  forceLookup = false) const

Returns true if the stored procedure encapsulated by self exists in the database. If the result was cached in self, returns the cached result. Otherwise, if the result was previously cached in the cache manager installed on the RWDBDatabase that produced self, returns the result found in the cache manager. If the result was not in either the local cache or cache manager, the database is queried, using a default database connection, and the retrieved result is returned and also stored in the local cache and the cache manager, if there is one.

By setting forceLookup to true, this method necessarily queries the database.

If for some reason the result cannot be obtained from either the caches or the database, this method returns false.

Note
The forceLookup parameter is deprecated. Use clearCache() to clear the metadata from the cache before calling this method.
bool RWDBStoredProc::exists ( const RWDBConnection connection,
bool  forceLookup = false 
) const

Returns true if the stored procedure encapsulated by self exists in the database. If the result was cached in self, returns the cached result. Otherwise, if the result was previously cached in the cache manager installed on the RWDBDatabase that produced self, returns the result found in the cache manager. If the result was not in either the local cache or cache manager, the database is queried, using the supplied connection, and the retrieved result is returned and also stored in the local cache and the cache manager, if there is one.

By setting forceLookup to true, this method necessarily queries the database.

If for some reason the result cannot be obtained from either the caches or the database, this method returns false.

Note
The forceLookup parameter is deprecated. Use clearCache() to clear the metadata from the cache before calling this method.
RWDBStatus RWDBStoredProc::fetchReturnParams ( )

The connection used by the last call to execute() is used to obtain any output parameters returned by the database stored procedure. If execute() has not yet been successfully invoked, sets self's status and returns RWDBStatus::notConnected. Some databases do not support return parameters, in this case RWDBStatus::notSupported is returned. This function behaves asynchronously if the stored procedure was created using an asynchronous connection.

bool RWDBStoredProc::isNull ( const RWDBColumn column) const

Returns true if the last value fetched into the output parameter with the same name as column was NULL. Otherwise returns false. If there is no such output parameter with the same name, self's status changes to RWDBStatus::invalidPosition.

bool RWDBStoredProc::isNull ( const RWCString name) const

Returns true if the last value fetched into the output parameter with the given name was NULL. Otherwise returns false. If there is no such output parameter with that given name, self's status changes to RWDBStatus::invalidPosition.

bool RWDBStoredProc::isNull ( size_t  index) const

Returns true if the last value fetched into the output parameter at position index was NULL. Otherwise returns false. If there is no such output parameter at index, self's status changes to RWDBStatus::invalidPosition.

bool RWDBStoredProc::isReady ( ) const

This function returns true if the object is in ready state, indicating that accessing the object will not block. Accessing a nonready object may potentially block.

bool RWDBStoredProc::isValid ( ) const

Returns true if self's status is RWDBStatus::ok, otherwise returns false.

RWCString RWDBStoredProc::name ( ) const

Returns self's name.

RWDBStoredProc& RWDBStoredProc::operator<< ( RWDBValueManip  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( const RWDBValue value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( char  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( unsigned char  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( short  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( unsigned short  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( int  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( unsigned int  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( long  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( unsigned long  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( long long  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( unsigned long long  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( float  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( double  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( long double  value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( const RWDecimalPortable value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( const RWDate value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( const RWDateTime value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( const RWDBDateTime value)
Deprecated:
As of SourcePro 12.5, use RWDBStoredProc::operator<<(const RWDateTime&) instead.

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( const RWDBDuration value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( const RWCString value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( const RWDBMBString value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( const RWBasicUString value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( const RWWString value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( const RWDBBlob value)

Passes value as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by one. The parameter is passed by value.

RWDBStoredProc& RWDBStoredProc::operator<< ( const RWDBBoundExpr value)

Inserts a placeholder and performs binding for in-type parameters. Here in-type binding includes in/out binding. The meaning of shifting in an RWDBBoundExpr with entries greater than 1 is vendor-dependent.

RWDBStoredProc& RWDBStoredProc::operator<< ( short *  valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( unsigned short *  valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( int *  valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( unsigned int *  valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( long *  valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( unsigned long *  valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( long long *  valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( unsigned long long *  valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( float *  valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( double *  valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( long double *  valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( RWDecimalPortable valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( RWDate valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( RWDateTime valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( RWDBDateTime valPtr)
Deprecated:
As of SourcePro 12.5, use RWDBStoredProc::operator<<(RWDateTime*) instead.

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( RWDBDuration valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( RWDBBlob valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( RWCString valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( RWDBMBString valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( RWBasicUString valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator<< ( RWWString valPtr)

Passes valPtr as the nth parameter to self, where n is the current position in self's formal parameter list, and increments the current position by 1. The parameter is passed by reference. After executing the stored procedure, the variable addressed by valPtr is updated by calling either fetchReturnParams() or returnValue().

RWDBStoredProc& RWDBStoredProc::operator= ( const RWDBStoredProc proc)

Assignment operator. Self shares an implementation with proc.

RWDBStoredProc& RWDBStoredProc::operator[] ( const RWDBColumn paramColumn)

Self's current row position is set to the index in self's schema of the first parameter whose name matches that of paramColumn. If there is no such parameter, self's status changes to RWDBStatus::invalidPosition. Returns reference to self.

RWDBStoredProc& RWDBStoredProc::operator[] ( const RWCString paramName)

Self's current row position is set to the index in self's schema of the first parameter whose name is paramName. If there is no such parameter, self's status changes to RWDBStatus::invalidPosition. Returns a reference to self.

RWDBStoredProc& RWDBStoredProc::operator[] ( size_t  index)

Self's current row position is set to index. If index is greater than or equal to the number of parameters expected by self, self's status is changed to RWDBStatus::invalidPosition. Returns a reference to self.

RWDBSchema RWDBStoredProc::params ( bool  forceLookup = false) const

Returns an RWDBSchema which represents self's formal parameter list. If the schema was cached in self, returns the cached schema. Otherwise, if the schema was previously cached in the cache manager installed on the RWDBDatabase that produced self, returns the schema found in the cache manager. If the schema was not in either the local cache or cache manager, the database is queried, using a default database connection, and the retrieved schema is returned and also stored in the local cache and the cache manager, if there is one.

By setting forceLookup to true, this method necessarily queries the database.

If for some reason the schema cannot be obtained from either the caches or the database, this method returns an empty schema and sets self's status to reflect the error.

Note
The forceLookup parameter is deprecated. Use clearCache() to clear the metadata from the cache before calling this method.
RWDBSchema RWDBStoredProc::params ( const RWDBConnection connection,
bool  forceLookup = false 
) const

Returns an RWDBSchema which represents self's formal parameter list. If the schema was cached in self, returns the cached schema. Otherwise, if the schema was previously cached in the cache manager installed on the RWDBDatabase that produced self, returns the schema found in the cache manager. If the schema was not in either the local cache or cache manager, the database is queried, using the supplied connection, and the retrieved schema is returned and also stored in the local cache and the cache manager, if there is one.

By setting forceLookup to true, this method necessarily queries the database.

If for some reason the schema cannot be obtained from either the caches or the database, this method returns an empty schema and sets self's status to reflect the error.

Note
The forceLookup parameter is deprecated. Use clearCache() to clear the metadata from the cache before calling this method.
size_t RWDBStoredProc::position ( ) const

Returns the current position, at which the next value will be shifted in using the insertion operator. Returns RW_NPOS if isValid() returns false.

void RWDBStoredProc::release ( ) const

Releases a previously acquired mutex. This function can be called from a const object.

Note
In single-threaded builds, this function evaluates to a no-op.
RWDBValue RWDBStoredProc::returnValue ( ) const

Calls fetchReturnParams(), then, if no error has occurred, obtains the return value of the most recent execution of self in the database and returns it. If there is no return value, or if an error has occurred, returns a NULL RWDBValue. In the latter case sets self's status to reflect the error.

RWDBColumn RWDBStoredProc::returnValueColumn ( ) const

Returns a deep copy of the RWDBColumn representing the datatype of self's return value. If there is no return value, returns an RWDBColumn whose status is RWDBStatus::columnNotFound.

void RWDBStoredProc::setErrorHandler ( RWDBStatus::ErrorHandler  handler)

Installs handler as self's error handler. The supplied handler is inherited by all objects produced by self. By default, an RWDBStatus::ErrorHandler is inherited from the object which produced self; this method overrides the default.

RWDBStatus RWDBStoredProc::status ( ) const

Returns the current status of self.

RWCString RWDBStoredProc::text ( bool  forceLookup = false) const

Returns the SQL text used to define the stored procedure encapsulated by self. If the text was cached in self, returns the cached text. Otherwise, if the text was previously cached in the cache manager installed on the RWDBDatabase that produced self, returns the text found in the cache manager. If the text was not in either the local cache or cache manager, the database is queried, using a default database connection, and the retrieved text is returned and also stored in the local cache and the cache manager, if there is one.

By setting forceLookup to true, this method necessarily queries the database.

If for some reason the text cannot be obtained from either the caches or the database, this method returns an empty string and sets self's status to reflect the error.

Note
The forceLookup parameter is deprecated. Use clearCache() to clear the metadata from the cache before calling this method.
RWCString RWDBStoredProc::text ( const RWDBConnection connection,
bool  forceLookup = false 
) const

Returns the SQL text used to define the stored procedure encapsulated by self. If the text was cached in self, returns the cached text. Otherwise, if the text was previously cached in the cache manager installed on the RWDBDatabase that produced self, returns the text found in the cache manager. If the text was not in either the local cache or cache manager, the database is queried, using the supplied connection, and the retrieved text is returned and also stored in the local cache and the cache manager, if there is one.

By setting forceLookup to true, this method necessarily queries the database.

If for some reason the text cannot be obtained from either the caches or the database, this method returns an empty string and sets self's status to reflect the error.

Note
The forceLookup parameter is deprecated. Use clearCache() to clear the metadata from the cache before calling this method.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.