Analysis Software
Documentation for sPHENIX simulation software
|
#include <RDBC/blob/master/include/RDBC/odbc++/preparedstatement.h>
Public Member Functions | |
virtual | ~PreparedStatement () |
void | clearParameters () |
bool | execute () |
ResultSet * | executeQuery () |
int | executeUpdate () |
bool | execute (const ODBCXX_STRING &) |
ResultSet * | executeQuery (const ODBCXX_STRING &) |
int | executeUpdate (const ODBCXX_STRING &) |
void | setDouble (int idx, double val) |
void | setBoolean (int idx, bool val) |
void | setByte (int idx, signed char val) |
void | setBytes (int idx, const ODBCXX_BYTES &val) |
void | setDate (int idx, const Date &val) |
void | setFloat (int idx, float val) |
void | setInt (int idx, int val) |
void | setLong (int idx, Long val) |
void | setShort (int idx, short val) |
void | setString (int idx, const ODBCXX_STRING &val) |
void | setTime (int idx, const Time &val) |
void | setTimestamp (int idx, const Timestamp &val) |
void | setAsciiStream (int idx, ODBCXX_STREAM *s, int len) |
void | setBinaryStream (int idx, ODBCXX_STREAM *s, int len) |
void | setNull (int idx, int sqlType) |
Public Member Functions inherited from odbc::Statement | |
virtual | ~Statement () |
Connection * | getConnection () |
void | cancel () |
int | getUpdateCount () |
ResultSet * | getResultSet () |
bool | getMoreResults () |
void | setCursorName (const ODBCXX_STRING &name) |
int | getFetchSize () |
void | setFetchSize (int size) |
int | getResultSetConcurrency () |
int | getResultSetType () |
int | getQueryTimeout () |
void | setQueryTimeout (int seconds) |
int | getMaxRows () |
void | setMaxRows (int maxRows) |
int | getMaxFieldSize () |
void | setMaxFieldSize (int maxFieldSize) |
void | setEscapeProcessing (bool on) |
bool | getEscapeProcessing () |
Public Member Functions inherited from odbc::ErrorHandler | |
void | clearWarnings () |
WarningList * | getWarnings () |
virtual | ~ErrorHandler () |
Protected Member Functions | |
PreparedStatement (Connection *con, SQLHSTMT hstmt, const ODBCXX_STRING &sql, int resultSetType, int resultSetConcurrency, int defaultDirection=SQL_PARAM_INPUT) | |
void | _bindParams () |
void | _unbindParams () |
void | _checkParam (int idx, int *allowed, int numAllowed, int defPrec, int defScale) |
Protected Member Functions inherited from odbc::Statement | |
const DriverInfo * | _getDriverInfo () const |
Statement (Connection *con, SQLHSTMT hstmt, int resultSetType, int resultSetConcurrency) | |
SQLUINTEGER | _getNumericOption (SQLINTEGER optnum) |
ODBCXX_STRING | _getStringOption (SQLINTEGER optnum) |
void | _setNumericOption (SQLINTEGER optnum, SQLUINTEGER value) |
void | _setStringOption (SQLINTEGER optnum, const ODBCXX_STRING &value) |
bool | _checkForResults () |
ResultSet * | _getResultSet (bool hideMe=false) |
void | _beforeExecute () |
void | _afterExecute () |
Protected Member Functions inherited from odbc::ErrorHandler | |
void | _postWarning (SQLWarning *w) |
void | _checkErrorODBC2 (SQLHENV henv, SQLHDBC hdbc, SQLHSTMT hstmt, SQLRETURN r, const ODBCXX_STRING &what) |
void | _checkStmtError (SQLHSTMT hstmt, SQLRETURN r, const char *what="") |
void | _checkConError (SQLHDBC hdbc, SQLRETURN r, const char *what="") |
void | _checkEnvError (SQLHENV henv, SQLRETURN r, const char *what="") |
ErrorHandler (bool collectWarnings=true) | |
Protected Attributes | |
ODBCXX_STRING | sql_ |
Rowset * | rowset_ |
size_t | numParams_ |
std::vector< int > | directions_ |
int | defaultDirection_ |
bool | paramsBound_ |
Protected Attributes inherited from odbc::Statement | |
Connection * | connection_ |
SQLHSTMT | hstmt_ |
int | lastExecute_ |
Private Member Functions | |
void | _prepare () |
void | _setupParams () |
Friends | |
class | Connection |
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:
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();
Definition at line 61 of file preparedstatement.h.
View newest version in sPHENIX GitHub at line 61 of file preparedstatement.h
|
protected |
|
virtual |
Destructor
|
protected |
|
protected |
|
private |
|
private |
|
protected |
void odbc::PreparedStatement::clearParameters | ( | ) |
Clears the parameters.
The set of parameters stays around until they are set again. To explicitly clear them (and thus release buffers held by the driver), this method should be called.
Referenced by ODBCPreparedStatement::ClearParameters(), and ODBCCallableStatement::ClearParameters().
bool odbc::PreparedStatement::execute | ( | ) |
Executes this statement.
Referenced by ODBCPreparedStatement::Execute(), and ODBCCallableStatement::Execute().
|
inlinevirtual |
Reimplement virtual signatures in base class Statement that were hidden by argumentless versions above. 2003-05-02 rhatc her@ fnal. gov
Reimplemented from odbc::Statement.
Definition at line 120 of file preparedstatement.h.
View newest version in sPHENIX GitHub at line 120 of file preparedstatement.h
References execute().
Referenced by execute().
ResultSet* odbc::PreparedStatement::executeQuery | ( | ) |
Executes this statement, assuming it returns a ResultSet.
Referenced by ODBCPreparedStatement::ExecuteQuery(), ODBCCallableStatement::ExecuteQuery(), and OnCalServer::SyncCalibTimeStampsToOnCal().
|
inlinevirtual |
Execute an SQL statement, expected to return a resultset.
sql | The string to execute |
Reimplemented from odbc::Statement.
Definition at line 122 of file preparedstatement.h.
View newest version in sPHENIX GitHub at line 122 of file preparedstatement.h
References executeQuery().
Referenced by executeQuery().
int odbc::PreparedStatement::executeUpdate | ( | ) |
Executes this statement, assuming it returns an update count
Referenced by ODBCPreparedStatement::ExecuteUpdate(), ODBCCallableStatement::ExecuteUpdate(), OnCalServer::SyncCalibTimeStampsToOnCal(), and OnCalServer::SyncOncalTimeStampsToRunDB().
|
inlinevirtual |
Execute an SQL statement, expected to return an update count.
Reimplemented from odbc::Statement.
Definition at line 124 of file preparedstatement.h.
View newest version in sPHENIX GitHub at line 124 of file preparedstatement.h
References executeUpdate().
Referenced by executeUpdate().
void odbc::PreparedStatement::setAsciiStream | ( | int | idx, |
ODBCXX_STREAM * | s, | ||
int | len | ||
) |
Sets a parameter value to an ascii stream.
idx | The parameter index, starting at 1 |
val | The stream to assign |
len | The number of bytes available in the stream |
Referenced by ODBCPreparedStatement::SetAsciiStream(), and ODBCCallableStatement::SetAsciiStream().
void odbc::PreparedStatement::setBinaryStream | ( | int | idx, |
ODBCXX_STREAM * | s, | ||
int | len | ||
) |
Sets a parameter value to a binary stream.
idx | The parameter index, starting at 1 |
s | The stream to assign |
len | The number of bytes available in the stream |
Referenced by ODBCPreparedStatement::SetBinaryStream(), and ODBCCallableStatement::SetBinaryStream().
void odbc::PreparedStatement::setBoolean | ( | int | idx, |
bool | val | ||
) |
Sets a parameter value to a bool
idx | The parameter index, starting at 1 |
val | The value to set |
Referenced by ODBCPreparedStatement::SetBoolean(), and ODBCCallableStatement::SetBoolean().
void odbc::PreparedStatement::setByte | ( | int | idx, |
signed char | val | ||
) |
Sets a parameter value to signed char
idx | The parameter index, starting at 1 |
val | The value to set |
Referenced by ODBCPreparedStatement::SetByte(), and ODBCCallableStatement::SetByte().
void odbc::PreparedStatement::setBytes | ( | int | idx, |
const ODBCXX_BYTES & | val | ||
) |
Sets a parameter value to a chunk of bytes
idx | The parameter index, starting at 1 |
val | The value to set |
Referenced by ODBCPreparedStatement::SetBytes(), and ODBCCallableStatement::SetBytes().
void odbc::PreparedStatement::setDate | ( | int | idx, |
const Date & | val | ||
) |
Sets a parameter value to a Date
idx | The parameter index, starting at 1 |
val | The value to set |
Referenced by ODBCPreparedStatement::SetDate(), and ODBCCallableStatement::SetDate().
void odbc::PreparedStatement::setDouble | ( | int | idx, |
double | val | ||
) |
Sets a parameter value to a double
idx | The parameter index, starting at 1 |
val | The value to set |
Referenced by ODBCPreparedStatement::SetDouble(), and ODBCCallableStatement::SetDouble().
void odbc::PreparedStatement::setFloat | ( | int | idx, |
float | val | ||
) |
Sets a parameter value to a float
idx | The parameter index, starting at 1 |
val | The value to set |
Referenced by ODBCPreparedStatement::SetFloat(), and ODBCCallableStatement::SetFloat().
void odbc::PreparedStatement::setInt | ( | int | idx, |
int | val | ||
) |
Sets a parameter value to an int
idx | The parameter index, starting at 1 |
val | The value to set |
Referenced by ODBCPreparedStatement::SetInt(), ODBCCallableStatement::SetInt(), and OnCalServer::SyncCalibTimeStampsToOnCal().
void odbc::PreparedStatement::setLong | ( | int | idx, |
Long | val | ||
) |
Sets a parameter value to a Long
idx | The parameter index, starting at 1 |
val | The value to set |
Referenced by ODBCPreparedStatement::SetLong(), ODBCCallableStatement::SetLong(), and OnCalServer::SyncOncalTimeStampsToRunDB().
void odbc::PreparedStatement::setNull | ( | int | idx, |
int | sqlType | ||
) |
Sets a parameter value to NULL
idx | The parameter index, starting at 1 |
sqlType | The SQL type of the parameter |
Referenced by ODBCPreparedStatement::SetNull(), and ODBCCallableStatement::SetNull().
void odbc::PreparedStatement::setShort | ( | int | idx, |
short | val | ||
) |
Sets a parameter value to a short
idx | The parameter index, starting at 1 |
val | The value to set |
Referenced by ODBCPreparedStatement::SetShort(), and ODBCCallableStatement::SetShort().
void odbc::PreparedStatement::setString | ( | int | idx, |
const ODBCXX_STRING & | val | ||
) |
Sets a parameter value to a string
idx | The parameter index, starting at 1 |
val | The value to set |
Referenced by ODBCPreparedStatement::SetString(), and ODBCCallableStatement::SetString().
void odbc::PreparedStatement::setTime | ( | int | idx, |
const Time & | val | ||
) |
Sets a parameter value to a Time
idx | The parameter index, starting at 1 |
val | The value to set |
Referenced by ODBCPreparedStatement::SetTime(), and ODBCCallableStatement::SetTime().
void odbc::PreparedStatement::setTimestamp | ( | int | idx, |
const Timestamp & | val | ||
) |
Sets a parameter value to a Timestamp
idx | The parameter index, starting at 1 |
val | The value to set |
Referenced by ODBCPreparedStatement::SetTimestamp(), and ODBCCallableStatement::SetTimestamp().
|
friend |
Definition at line 62 of file preparedstatement.h.
View newest version in sPHENIX GitHub at line 62 of file preparedstatement.h
|
protected |
Definition at line 74 of file preparedstatement.h.
View newest version in sPHENIX GitHub at line 74 of file preparedstatement.h
|
protected |
Definition at line 73 of file preparedstatement.h.
View newest version in sPHENIX GitHub at line 73 of file preparedstatement.h
|
protected |
Definition at line 72 of file preparedstatement.h.
View newest version in sPHENIX GitHub at line 72 of file preparedstatement.h
|
protected |
Definition at line 75 of file preparedstatement.h.
View newest version in sPHENIX GitHub at line 75 of file preparedstatement.h
|
protected |
Definition at line 71 of file preparedstatement.h.
View newest version in sPHENIX GitHub at line 71 of file preparedstatement.h
|
protected |
Definition at line 69 of file preparedstatement.h.
View newest version in sPHENIX GitHub at line 69 of file preparedstatement.h