libodbc++  0.2.5
Public Member Functions | List of all members
odbc::CallableStatement Class Reference

A prepared statement suited for stored procedure calls. More...

#include <callablestatement.h>

Inheritance diagram for odbc::CallableStatement:
odbc::PreparedStatement odbc::Statement odbc::ErrorHandler

Public Member Functions

virtual ~CallableStatement ()
 Destructor.
 
double getDouble (int idx)
 Fetches a parameter as a double. More...
 
bool getBoolean (int idx)
 Fetches a parameter as a bool. More...
 
signed char getByte (int idx)
 Fetches a parameter as a signed char. More...
 
Bytes getBytes (int idx)
 Fetches a parameter as a Bytes object. More...
 
Date getDate (int idx)
 Fetches a parameter as a Date. More...
 
float getFloat (int idx)
 Fetches a parameter as a float. More...
 
int getInt (int idx)
 Fetches a parameter as an int. More...
 
Long getLong (int idx)
 Fetches a parameter as a Long. More...
 
short getShort (int idx)
 Fetches a parameter as a short. More...
 
std::string getString (int idx)
 Fetches a parameter as a string. More...
 
Time getTime (int idx)
 Fetches a parameter as a Time. More...
 
Timestamp getTimestamp (int idx)
 Fetches a parameter as a Timestamp. More...
 
void registerOutParameter (int idx, int sqlType)
 Registers an output parameter. More...
 
void registerOutParameter (int idx, int sqlType, int scale)
 Registers an output parameter with a given scale. More...
 
void registerInParameter (int idx)
 Registers an input only parameter. More...
 
bool wasNull ()
 Returns true if the last fetched parameter was NULL.
 
- Public Member Functions inherited from odbc::PreparedStatement
virtual ~PreparedStatement ()
 Destructor.
 
void clearParameters ()
 Clears the parameters. More...
 
bool execute ()
 Executes this statement. More...
 
ResultSetexecuteQuery ()
 Executes this statement, assuming it returns a ResultSet. More...
 
int executeUpdate ()
 Executes this statement, assuming it returns an update count.
 
void setDouble (int idx, double val)
 Sets a parameter value to a double. More...
 
void setBoolean (int idx, bool val)
 Sets a parameter value to a bool. More...
 
void setByte (int idx, signed char val)
 Sets a parameter value to signed char. More...
 
void setBytes (int idx, const Bytes &val)
 Sets a parameter value to a chunk of bytes. More...
 
void setDate (int idx, const Date &val)
 Sets a parameter value to a Date. More...
 
void setFloat (int idx, float val)
 Sets a parameter value to a float. More...
 
void setInt (int idx, int val)
 Sets a parameter value to an int. More...
 
void setLong (int idx, Long val)
 Sets a parameter value to a Long. More...
 
void setShort (int idx, short val)
 Sets a parameter value to a short. More...
 
void setString (int idx, const std::string &val)
 Sets a parameter value to a string. More...
 
void setTime (int idx, const Time &val)
 Sets a parameter value to a Time. More...
 
void setTimestamp (int idx, const Timestamp &val)
 Sets a parameter value to a Timestamp. More...
 
void setAsciiStream (int idx, std::istream *s, int len)
 Sets a parameter value to an ascii stream. More...
 
void setBinaryStream (int idx, std::istream *s, int len)
 Sets a parameter value to a binary stream. More...
 
void setNull (int idx, int sqlType)
 Sets a parameter value to NULL. More...
 
- Public Member Functions inherited from odbc::Statement
virtual ~Statement ()
 Destructor. More...
 
ConnectiongetConnection ()
 Returns the connection that created this statement.
 
void cancel ()
 Cancel an ongoing operation that was executed in another thread.
 
virtual bool execute (const std::string &sql)
 Execute a given SQL statement. More...
 
virtual ResultSetexecuteQuery (const std::string &sql)
 Execute an SQL statement, expected to return a resultset. More...
 
virtual int executeUpdate (const std::string &sql)
 Execute an SQL statement, expected to return an update count. More...
 
int getUpdateCount ()
 Fetch the current result as an update count. More...
 
ResultSetgetResultSet ()
 Fetch the current result as a ResultSet.
 
bool getMoreResults ()
 Check if there are more results available on this statment. More...
 
void setCursorName (const std::string &name)
 Set the cursor name for this statement.
 
int getFetchSize ()
 Fetch the current fetch size (also called rowset size) for resultsets created by this statement.
 
void setFetchSize (int size)
 Set the current fetch size for resultsets created by this statement.
 
int getResultSetConcurrency ()
 Get the concurrency type for resultsets created by this statement.
 
int getResultSetType ()
 Get the type for resultsets created by this statement.
 
int getQueryTimeout ()
 Get the query timeout for this statement.
 
void setQueryTimeout (int seconds)
 Set the query timeout for this statement.
 
int getMaxRows ()
 Get the maximum number of rows to return in a resultset.
 
void setMaxRows (int maxRows)
 Set the maximum number of rows to return in a resultset.
 
int getMaxFieldSize ()
 Get the maximum field size for resultsets create by this statement.
 
void setMaxFieldSize (int maxFieldSize)
 Set the maximum field size for resultsets create by this statement.
 
void setEscapeProcessing (bool on)
 Sets escape processing on or off. More...
 
bool getEscapeProcessing ()
 Gets the current escape processing setting. More...
 
void close ()
 Closes all result sets from this execution. More...
 
- Public Member Functions inherited from odbc::ErrorHandler
void clearWarnings ()
 Clears all the warnings stored in this object.
 
WarningList * getWarnings ()
 Fetches all the warnings in this object. More...
 
virtual ~ErrorHandler ()
 Destructor.
 

Additional Inherited Members

- Protected Member Functions inherited from odbc::ErrorHandler
 ErrorHandler (bool collectWarnings=true)
 Constructor.
 

Detailed Description

A prepared statement suited for stored procedure calls.

A CallableStatement extends the functionality of a PreparedStatement, by allowing output parameters.

The ODBC escapes for calling stored procedures and functions should be used. A procedure call is prepared like this:

std::auto_ptr<CallableStatement> cstmt(con->prepareCall
    ("{call my_procedure(?,?,?)}"));

And for a function call (a procedure that returns a value), the following syntax should be used:

std::auto_ptr<CallableStatement> cstmt(con->prepareCall
    ("{?=call my_function(?,?)}"));

All parameters in a CallableStatement are treated as input/output parameters, unless they are registered as output-only parameters with registerOutParameter(). Note that output-only parameters must be registered with their proper SQL type prior to executing a CallableStatement.

Member Function Documentation

bool odbc::CallableStatement::getBoolean ( int  idx)

Fetches a parameter as a bool.

Parameters
idxThe parameter index, starting at 1
signed char odbc::CallableStatement::getByte ( int  idx)

Fetches a parameter as a signed char.

Parameters
idxThe parameter index, starting at 1
Bytes odbc::CallableStatement::getBytes ( int  idx)

Fetches a parameter as a Bytes object.

Parameters
idxThe parameter index, starting at 1
Date odbc::CallableStatement::getDate ( int  idx)

Fetches a parameter as a Date.

Parameters
idxThe parameter index, starting at 1
double odbc::CallableStatement::getDouble ( int  idx)

Fetches a parameter as a double.

Parameters
idxThe parameter index, starting at 1
float odbc::CallableStatement::getFloat ( int  idx)

Fetches a parameter as a float.

Parameters
idxThe parameter index, starting at 1
int odbc::CallableStatement::getInt ( int  idx)

Fetches a parameter as an int.

Parameters
idxThe parameter index, starting at 1
Long odbc::CallableStatement::getLong ( int  idx)

Fetches a parameter as a Long.

Parameters
idxThe parameter index, starting at 1
short odbc::CallableStatement::getShort ( int  idx)

Fetches a parameter as a short.

Parameters
idxThe parameter index, starting at 1
std::string odbc::CallableStatement::getString ( int  idx)

Fetches a parameter as a string.

Parameters
idxThe parameter index, starting at 1
Time odbc::CallableStatement::getTime ( int  idx)

Fetches a parameter as a Time.

Parameters
idxThe parameter index, starting at 1
Timestamp odbc::CallableStatement::getTimestamp ( int  idx)

Fetches a parameter as a Timestamp.

Parameters
idxThe parameter index, starting at 1
void odbc::CallableStatement::registerInParameter ( int  idx)

Registers an input only parameter.

Parameters
idxThe parameter index, starting at 1
void odbc::CallableStatement::registerOutParameter ( int  idx,
int  sqlType 
)

Registers an output parameter.

Parameters
idxThe parameter index, starting at 1
sqlTypeThe SQL type of the parameter
See also
Types
void odbc::CallableStatement::registerOutParameter ( int  idx,
int  sqlType,
int  scale 
)

Registers an output parameter with a given scale.

Parameters
idxThe parameter index, starting at 1
sqlTypeThe SQL type of the parameter
scaleThe scale of the parameter.
See also
Types

The documentation for this class was generated from the following file:

Go back to the libodbc++ homepage