#include <callablestatement.h>
Inheritance diagram for odbc::CallableStatement:
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 =stdauto_ptr<CallableStatement>(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 =stdauto_ptr<CallableStatement>(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
.
double odbc::CallableStatement::getDouble | ( | int | idx | ) |
Fetches a parameter as a double.
idx | The parameter index, starting at 1 |
bool odbc::CallableStatement::getBoolean | ( | int | idx | ) |
Fetches a parameter as a bool.
idx | The parameter index, starting at 1 |
signed char odbc::CallableStatement::getByte | ( | int | idx | ) |
Fetches a parameter as a signed char.
idx | The parameter index, starting at 1 |
Bytes odbc::CallableStatement::getBytes | ( | int | idx | ) |
Date odbc::CallableStatement::getDate | ( | int | idx | ) |
float odbc::CallableStatement::getFloat | ( | int | idx | ) |
Fetches a parameter as a float.
idx | The parameter index, starting at 1 |
int odbc::CallableStatement::getInt | ( | int | idx | ) |
Fetches a parameter as an int.
idx | The parameter index, starting at 1 |
Long odbc::CallableStatement::getLong | ( | int | idx | ) |
Fetches a parameter as a Long.
idx | The parameter index, starting at 1 |
short odbc::CallableStatement::getShort | ( | int | idx | ) |
Fetches a parameter as a short.
idx | The parameter index, starting at 1 |
std::string odbc::CallableStatement::getString | ( | int | idx | ) |
Fetches a parameter as a string.
idx | The parameter index, starting at 1 |
Time odbc::CallableStatement::getTime | ( | int | idx | ) |
Timestamp odbc::CallableStatement::getTimestamp | ( | int | idx | ) |
void odbc::CallableStatement::registerOutParameter | ( | int | idx, | |
int | sqlType | |||
) |
Registers an output parameter.
idx | The parameter index, starting at 1 | |
sqlType | The SQL type of the parameter |
void odbc::CallableStatement::registerOutParameter | ( | int | idx, | |
int | sqlType, | |||
int | scale | |||
) |
Registers an output parameter with a given scale.
idx | The parameter index, starting at 1 | |
sqlType | The SQL type of the parameter | |
scale | The scale of the parameter. |
void odbc::CallableStatement::registerInParameter | ( | int | idx | ) |
Registers an input only parameter.
idx | The parameter index, starting at 1 |