|
virtual | ~PreparedStatement () |
| Destructor.
|
|
void | clearParameters () |
| Clears the parameters. More...
|
|
bool | execute () |
| Executes this statement. More...
|
|
ResultSet * | executeQuery () |
| 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...
|
|
virtual | ~Statement () |
| Destructor. More...
|
|
Connection * | getConnection () |
| 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 ResultSet * | executeQuery (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...
|
|
ResultSet * | getResultSet () |
| 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.
|
|
A prepared statement.
A prepared statement is precompiled by the driver and/or datasource, and can be executed multiple times with different parameters.
Parameters are set using the setXXX methods. Note that it's advisable to use the set method compatible with the parameter's SQL type - for example, for a Types::DATE
, setDate()
should be used. Question marks ("?"
) are used in the SQL statement to represent a parameter, for example:
std::auto_ptr<PreparedStatement> pstmt(con->prepareStatement
("INSERT INTO SOMETABLE(AN_INTEGER_COL,A_VARCHAR_COL) VALUES(?,?)"));
pstmt->setInt(1,10);
pstmt->setString(2,"Hello, world!");
int affectedRows=pstmt->executeUpdate();
- See Also
- Connection::prepareStatement()