SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
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 RWCString &name) const
 
bool isNull (const RWDBColumn &column) const
 
bool isNull (size_t index) const
 
bool isReady () const
 
bool isValid () const
 
RWCString name () const
 
RWDBStoredProcoperator<< (char value)
 
RWDBStoredProcoperator<< (const RWBasicUString &value)
 
RWDBStoredProcoperator<< (const RWCString &value)
 
RWDBStoredProcoperator<< (const RWDate &value)
 
RWDBStoredProcoperator<< (const RWDateTime &value)
 
RWDBStoredProcoperator<< (const RWDBBlob &value)
 
RWDBStoredProcoperator<< (const RWDBBoundExpr &value)
 
RWDBStoredProcoperator<< (const RWDBDateTime &value)
 
RWDBStoredProcoperator<< (const RWDBDuration &value)
 
RWDBStoredProcoperator<< (const RWDBMBString &value)
 
RWDBStoredProcoperator<< (const RWDBValue &value)
 
RWDBStoredProcoperator<< (const RWDecimalPortable &value)
 
RWDBStoredProcoperator<< (const RWWString &value)
 
RWDBStoredProcoperator<< (double *valPtr)
 
RWDBStoredProcoperator<< (double value)
 
RWDBStoredProcoperator<< (float *valPtr)
 
RWDBStoredProcoperator<< (float value)
 
RWDBStoredProcoperator<< (int *valPtr)
 
RWDBStoredProcoperator<< (int value)
 
RWDBStoredProcoperator<< (long *valPtr)
 
RWDBStoredProcoperator<< (long double *valPtr)
 
RWDBStoredProcoperator<< (long double value)
 
RWDBStoredProcoperator<< (long long *valPtr)
 
RWDBStoredProcoperator<< (long long value)
 
RWDBStoredProcoperator<< (long value)
 
RWDBStoredProcoperator<< (RWBasicUString *valPtr)
 
RWDBStoredProcoperator<< (RWCString *valPtr)
 
RWDBStoredProcoperator<< (RWDate *valPtr)
 
RWDBStoredProcoperator<< (RWDateTime *valPtr)
 
RWDBStoredProcoperator<< (RWDBBlob *valPtr)
 
RWDBStoredProcoperator<< (RWDBDateTime *valPtr)
 
RWDBStoredProcoperator<< (RWDBDuration *valPtr)
 
RWDBStoredProcoperator<< (RWDBMBString *valPtr)
 
RWDBStoredProcoperator<< (RWDBValueManip value)
 
RWDBStoredProcoperator<< (RWDecimalPortable *valPtr)
 
RWDBStoredProcoperator<< (RWWString *valPtr)
 
RWDBStoredProcoperator<< (short *valPtr)
 
RWDBStoredProcoperator<< (short value)
 
RWDBStoredProcoperator<< (unsigned char value)
 
RWDBStoredProcoperator<< (unsigned int *valPtr)
 
RWDBStoredProcoperator<< (unsigned int value)
 
RWDBStoredProcoperator<< (unsigned long *valPtr)
 
RWDBStoredProcoperator<< (unsigned long long *valPtr)
 
RWDBStoredProcoperator<< (unsigned long long value)
 
RWDBStoredProcoperator<< (unsigned long value)
 
RWDBStoredProcoperator<< (unsigned short *valPtr)
 
RWDBStoredProcoperator<< (unsigned short value)
 
RWDBStoredProcoperator= (const RWDBStoredProc &proc)
 
RWDBStoredProcoperator[] (const RWCString &paramName)
 
RWDBStoredProcoperator[] (const RWDBColumn &paramColumn)
 
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;
Offers powerful and convenient facilities for manipulating strings.
Definition stdcstring.h:826

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");
Encapsulates a database stored procedure, providing a uniform API to the common operations related to...
Definition stored.h:144
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;
}
RWDBResult execute()
RWDBValue returnValue() const
RWCString name() const
Provides storage for C++ primitive types and structured types used by the DB Interface Module,...
Definition value.h:116
int asInt() const

Member Enumeration Documentation

◆ CacheType

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() [1/2]

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() [2/2]

RWDBStoredProc::RWDBStoredProc ( const RWDBStoredProc & proc)

Copy constructor. Self shares an implementation with proc.

Member Function Documentation

◆ acquire()

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.

◆ clear()

RWDBStatus RWDBStoredProc::clear ( )

Clears all internal state.

◆ clearCache()

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.

◆ database()

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.

◆ drop() [1/2]

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.

◆ drop() [2/2]

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.

◆ errorHandler()

RWDBStatus::ErrorHandler RWDBStoredProc::errorHandler ( ) const

Returns the error handler attached to self.

◆ execute() [1/2]

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.

◆ execute() [2/2]

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.

◆ exists() [1/2]

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.

◆ exists() [2/2]

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.

◆ fetchReturnParams()

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.

◆ isNull() [1/3]

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.

◆ isNull() [2/3]

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.

◆ isNull() [3/3]

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.

◆ isReady()

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.

◆ isValid()

bool RWDBStoredProc::isValid ( ) const

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

◆ name()

RWCString RWDBStoredProc::name ( ) const

Returns self's name.

◆ operator<<() [1/47]

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.

◆ operator<<() [2/47]

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.

◆ operator<<() [3/47]

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.

◆ operator<<() [4/47]

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.

◆ operator<<() [5/47]

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.

◆ operator<<() [6/47]

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.

◆ operator<<() [7/47]

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.

◆ operator<<() [8/47]

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.

◆ operator<<() [9/47]

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.

◆ operator<<() [10/47]

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.

◆ operator<<() [11/47]

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.

◆ operator<<() [12/47]

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.

◆ operator<<() [13/47]

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.

◆ operator<<() [14/47]

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().

◆ operator<<() [15/47]

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.

◆ operator<<() [16/47]

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().

◆ operator<<() [17/47]

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.

◆ operator<<() [18/47]

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().

◆ operator<<() [19/47]

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.

◆ operator<<() [20/47]

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().

◆ operator<<() [21/47]

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().

◆ operator<<() [22/47]

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.

◆ operator<<() [23/47]

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().

◆ operator<<() [24/47]

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.

◆ operator<<() [25/47]

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.

◆ operator<<() [26/47]

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().

◆ operator<<() [27/47]

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().

◆ operator<<() [28/47]

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().

◆ operator<<() [29/47]

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().

◆ operator<<() [30/47]

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().

◆ operator<<() [31/47]

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().

◆ operator<<() [32/47]

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().

◆ operator<<() [33/47]

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().

◆ operator<<() [34/47]

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.

◆ operator<<() [35/47]

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().

◆ operator<<() [36/47]

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().

◆ operator<<() [37/47]

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().

◆ operator<<() [38/47]

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.

◆ operator<<() [39/47]

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.

◆ operator<<() [40/47]

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().

◆ operator<<() [41/47]

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.

◆ operator<<() [42/47]

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().

◆ operator<<() [43/47]

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().

◆ operator<<() [44/47]

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.

◆ operator<<() [45/47]

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.

◆ operator<<() [46/47]

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().

◆ operator<<() [47/47]

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.

◆ operator=()

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

Assignment operator. Self shares an implementation with proc.

◆ operator[]() [1/3]

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.

◆ operator[]() [2/3]

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.

◆ operator[]() [3/3]

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.

◆ params() [1/2]

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.

◆ params() [2/2]

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.

◆ position()

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.

◆ release()

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.

◆ returnValue()

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.

◆ returnValueColumn()

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.

◆ setErrorHandler()

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.

◆ status()

RWDBStatus RWDBStoredProc::status ( ) const

Returns the current status of self.

◆ text() [1/2]

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.

◆ text() [2/2]

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 © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.