Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
odbc::Statement Class Reference

#include <RDBC/blob/master/include/RDBC/odbc++/statement.h>

+ Inheritance diagram for odbc::Statement:
+ Collaboration diagram for odbc::Statement:

Public Member Functions

virtual ~Statement ()
 
ConnectiongetConnection ()
 
void cancel ()
 
virtual bool execute (const ODBCXX_STRING &sql)
 
virtual ResultSetexecuteQuery (const ODBCXX_STRING &sql)
 
virtual int executeUpdate (const ODBCXX_STRING &sql)
 
int getUpdateCount ()
 
ResultSetgetResultSet ()
 
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 ()
 
WarningListgetWarnings ()
 
virtual ~ErrorHandler ()
 

Protected Member Functions

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

Connectionconnection_
 
SQLHSTMT hstmt_
 
int lastExecute_
 

Private Types

enum  StatementState { STATE_CLOSED, STATE_OPEN }
 

Private Member Functions

void _registerResultSet (ResultSet *rs)
 
void _unregisterResultSet (ResultSet *rs)
 
void _applyResultSetType ()
 
ResultSet_getTypeInfo ()
 
ResultSet_getTables (const ODBCXX_STRING &catalog, const ODBCXX_STRING &schema, const ODBCXX_STRING &tableName, const ODBCXX_STRING &types)
 
ResultSet_getTablePrivileges (const ODBCXX_STRING &catalog, const ODBCXX_STRING &schema, const ODBCXX_STRING &tableName)
 
ResultSet_getColumnPrivileges (const ODBCXX_STRING &catalog, const ODBCXX_STRING &schema, const ODBCXX_STRING &tableName, const ODBCXX_STRING &columnName)
 
ResultSet_getPrimaryKeys (const ODBCXX_STRING &catalog, const ODBCXX_STRING &schema, const ODBCXX_STRING &tableName)
 
ResultSet_getColumns (const ODBCXX_STRING &catalog, const ODBCXX_STRING &schema, const ODBCXX_STRING &tableName, const ODBCXX_STRING &columnName)
 
ResultSet_getIndexInfo (const ODBCXX_STRING &catalog, const ODBCXX_STRING &schema, const ODBCXX_STRING &tableName, bool unique, bool approximate)
 
ResultSet_getCrossReference (const ODBCXX_STRING &pc, const ODBCXX_STRING &ps, const ODBCXX_STRING &pt, const ODBCXX_STRING &fc, const ODBCXX_STRING &fs, const ODBCXX_STRING &ft)
 
ResultSet_getProcedures (const ODBCXX_STRING &catalog, const ODBCXX_STRING &schema, const ODBCXX_STRING &procName)
 
ResultSet_getProcedureColumns (const ODBCXX_STRING &catalog, const ODBCXX_STRING &schema, const ODBCXX_STRING &procName, const ODBCXX_STRING &colName)
 
ResultSet_getSpecialColumns (const ODBCXX_STRING &catalog, const ODBCXX_STRING &schema, const ODBCXX_STRING &table, int what, int scope, int nullable)
 

Private Attributes

ResultSetcurrentResultSet_
 
int fetchSize_
 
int resultSetType_
 
int resultSetConcurrency_
 
StatementState state_
 
std::vector< ODBCXX_STRINGbatches_
 

Friends

class Connection
 
class ResultSet
 
class DatabaseMetaData
 

Detailed Description

A simple non-prepared statement

Definition at line 36 of file statement.h.

View newest version in sPHENIX GitHub at line 36 of file statement.h

Member Enumeration Documentation

Enumerator:
STATE_CLOSED 
STATE_OPEN 

Definition at line 58 of file statement.h.

View newest version in sPHENIX GitHub at line 58 of file statement.h

Constructor & Destructor Documentation

odbc::Statement::Statement ( Connection con,
SQLHSTMT  hstmt,
int  resultSetType,
int  resultSetConcurrency 
)
protected
virtual odbc::Statement::~Statement ( )
virtual

Destructor. Destroys/closes this statement as well as all created resultsets.

Member Function Documentation

void odbc::Statement::_afterExecute ( )
protected
void odbc::Statement::_applyResultSetType ( )
private
void odbc::Statement::_beforeExecute ( )
protected
bool odbc::Statement::_checkForResults ( )
protected
ResultSet* odbc::Statement::_getColumnPrivileges ( const ODBCXX_STRING catalog,
const ODBCXX_STRING schema,
const ODBCXX_STRING tableName,
const ODBCXX_STRING columnName 
)
private
ResultSet* odbc::Statement::_getColumns ( const ODBCXX_STRING catalog,
const ODBCXX_STRING schema,
const ODBCXX_STRING tableName,
const ODBCXX_STRING columnName 
)
private
ResultSet* odbc::Statement::_getCrossReference ( const ODBCXX_STRING pc,
const ODBCXX_STRING ps,
const ODBCXX_STRING pt,
const ODBCXX_STRING fc,
const ODBCXX_STRING fs,
const ODBCXX_STRING ft 
)
private
const DriverInfo* odbc::Statement::_getDriverInfo ( ) const
inlineprotected

Definition at line 46 of file statement.h.

View newest version in sPHENIX GitHub at line 46 of file statement.h

ResultSet* odbc::Statement::_getIndexInfo ( const ODBCXX_STRING catalog,
const ODBCXX_STRING schema,
const ODBCXX_STRING tableName,
bool  unique,
bool  approximate 
)
private
SQLUINTEGER odbc::Statement::_getNumericOption ( SQLINTEGER  optnum)
protected
ResultSet* odbc::Statement::_getPrimaryKeys ( const ODBCXX_STRING catalog,
const ODBCXX_STRING schema,
const ODBCXX_STRING tableName 
)
private
ResultSet* odbc::Statement::_getProcedureColumns ( const ODBCXX_STRING catalog,
const ODBCXX_STRING schema,
const ODBCXX_STRING procName,
const ODBCXX_STRING colName 
)
private
ResultSet* odbc::Statement::_getProcedures ( const ODBCXX_STRING catalog,
const ODBCXX_STRING schema,
const ODBCXX_STRING procName 
)
private
ResultSet* odbc::Statement::_getResultSet ( bool  hideMe = false)
protected
ResultSet* odbc::Statement::_getSpecialColumns ( const ODBCXX_STRING catalog,
const ODBCXX_STRING schema,
const ODBCXX_STRING table,
int  what,
int  scope,
int  nullable 
)
private
ODBCXX_STRING odbc::Statement::_getStringOption ( SQLINTEGER  optnum)
protected
ResultSet* odbc::Statement::_getTablePrivileges ( const ODBCXX_STRING catalog,
const ODBCXX_STRING schema,
const ODBCXX_STRING tableName 
)
private
ResultSet* odbc::Statement::_getTables ( const ODBCXX_STRING catalog,
const ODBCXX_STRING schema,
const ODBCXX_STRING tableName,
const ODBCXX_STRING types 
)
private
ResultSet* odbc::Statement::_getTypeInfo ( )
private
void odbc::Statement::_registerResultSet ( ResultSet rs)
private
void odbc::Statement::_setNumericOption ( SQLINTEGER  optnum,
SQLUINTEGER  value 
)
protected
void odbc::Statement::_setStringOption ( SQLINTEGER  optnum,
const ODBCXX_STRING value 
)
protected
void odbc::Statement::_unregisterResultSet ( ResultSet rs)
private
void odbc::Statement::cancel ( )

Cancel an ongoing operation that was executed in another thread

Referenced by ODBCStatement::Cancel(), ODBCPreparedStatement::Cancel(), and ODBCCallableStatement::Cancel().

+ Here is the caller graph for this function:

virtual bool odbc::Statement::execute ( const ODBCXX_STRING sql)
virtual

Execute a given SQL statement. The statement can return multiple results. To get to the next result after processing the first one, getMoreResults() should be called.

Parameters
sqlThe string to execute
Returns
true if a resultset is available

Reimplemented in odbc::PreparedStatement.

Referenced by ODBCStatement::Execute(), ODBCPreparedStatement::Execute(), and ODBCCallableStatement::Execute().

+ Here is the caller graph for this function:

virtual ResultSet* odbc::Statement::executeQuery ( const ODBCXX_STRING sql)
virtual

Execute an SQL statement, expected to return a resultset.

Parameters
sqlThe string to execute
Returns
A ResultSet object.

Reimplemented in odbc::PreparedStatement.

Referenced by PktSizeDBodbc::AddRow(), OnlMonDBodbc::AddRow(), OnlMonClient::CacheRunDB(), OnlMonServer::CacheRunDB(), OnCalServer::check_calibrator_in_statustable(), OnCalServer::check_create_subsystable(), OnCalServer::check_create_successtable(), PktSizeDBodbc::CheckAndAddColumns(), OnlMonStatusDB::CheckAndCreateMonitor(), OnlMonStatusDB::CheckAndCreateTable(), PktSizeDBodbc::CheckAndCreateTable(), OnlMonDBodbc::CheckAndCreateTable(), OnCalServer::ClosestGoodRun(), OnCalServer::CreateCalibration(), OnlMonDBodbc::CreateTable(), FROG::dCacheSearch(), OnlMonDBodbc::Dump(), ODBCStatement::ExecuteQuery(), ODBCPreparedStatement::ExecuteQuery(), ODBCCallableStatement::ExecuteQuery(), OnCalServer::FindClosestCalibratedRun(), OnlMonStatusDB::findRunNumInDB(), OnCalServer::findRunNumInDB(), OnCalServer::FixMissingCalibration(), OnCalServer::GetCalibStatus(), OnCalDBodbc::GetLastCalibratedRun(), OnCalServer::GetLastGoodRunTS(), PktSizeDBodbc::GetPacketContent(), RunToTimePg::getRunNumber(), RunDBodbc::GetRunNumbers(), RunToTimePg::getTime(), OnlMonDBodbc::GetVar(), OnlMonDBodbc::Info(), FROG::LustreSearch(), FROG::MinIOSearch(), FROG::PGSearch(), RunDBodbc::RunType(), OnCalServer::SyncCalibTimeStampsToOnCal(), OnCalServer::SyncOncalTimeStampsToRunDB(), OnCalServer::updateDB(), and FROG::XRootDSearch().

+ Here is the caller graph for this function:

Connection* odbc::Statement::getConnection ( )

Returns the connection that created this statement

bool odbc::Statement::getEscapeProcessing ( )

Gets the current escape processing setting

Returns
true if escape processing is on, false otherwise

Referenced by ODBCStatement::GetEscapeProcessing(), ODBCPreparedStatement::GetEscapeProcessing(), and ODBCCallableStatement::GetEscapeProcessing().

+ Here is the caller graph for this function:

int odbc::Statement::getFetchSize ( )
inline

Fetch the current fetch size (also called rowset size) for resultsets created by this statement.

Definition at line 209 of file statement.h.

View newest version in sPHENIX GitHub at line 209 of file statement.h

Referenced by ODBCStatement::GetFetchSize(), ODBCPreparedStatement::GetFetchSize(), and ODBCCallableStatement::GetFetchSize().

+ Here is the caller graph for this function:

int odbc::Statement::getMaxFieldSize ( )

Get the maximum field size for resultsets create by this statement

Referenced by ODBCStatement::GetMaxFieldSize(), ODBCPreparedStatement::GetMaxFieldSize(), and ODBCCallableStatement::GetMaxFieldSize().

+ Here is the caller graph for this function:

int odbc::Statement::getMaxRows ( )

Get the maximum number of rows to return in a resultset

Referenced by ODBCStatement::GetMaxRows(), ODBCPreparedStatement::GetMaxRows(), and ODBCCallableStatement::GetMaxRows().

+ Here is the caller graph for this function:

bool odbc::Statement::getMoreResults ( )

Check if there are more results available on this statment.

Returns
True if this statement has more results to offer.

Referenced by ODBCStatement::GetMoreResults(), ODBCPreparedStatement::GetMoreResults(), and ODBCCallableStatement::GetMoreResults().

+ Here is the caller graph for this function:

int odbc::Statement::getQueryTimeout ( )

Get the query timeout for this statement

Referenced by ODBCStatement::GetQueryTimeout(), ODBCPreparedStatement::GetQueryTimeout(), and ODBCCallableStatement::GetQueryTimeout().

+ Here is the caller graph for this function:

ResultSet* odbc::Statement::getResultSet ( )

Fetch the current result as a ResultSet

Referenced by ODBCStatement::GetResultSet(), ODBCPreparedStatement::GetResultSet(), and ODBCCallableStatement::GetResultSet().

+ Here is the caller graph for this function:

int odbc::Statement::getResultSetConcurrency ( )
inline

Get the concurrency type for resultsets created by this statement

Definition at line 217 of file statement.h.

View newest version in sPHENIX GitHub at line 217 of file statement.h

Referenced by ODBCStatement::GetResultSetConcurrency(), ODBCPreparedStatement::GetResultSetConcurrency(), and ODBCCallableStatement::GetResultSetConcurrency().

+ Here is the caller graph for this function:

int odbc::Statement::getResultSetType ( )
inline

Get the type for resultsets created by this statement

Definition at line 222 of file statement.h.

View newest version in sPHENIX GitHub at line 222 of file statement.h

Referenced by ODBCStatement::GetResultSetType(), ODBCPreparedStatement::GetResultSetType(), and ODBCCallableStatement::GetResultSetType().

+ Here is the caller graph for this function:

int odbc::Statement::getUpdateCount ( )

Fetch the current result as an update count.

Returns
the current result's update count (affected rows), or -1 if the result is a ResultSet or if there are no more results.

Referenced by ODBCStatement::GetUpdateCount(), ODBCPreparedStatement::GetUpdateCount(), and ODBCCallableStatement::GetUpdateCount().

+ Here is the caller graph for this function:

void odbc::Statement::setCursorName ( const ODBCXX_STRING name)

Set the cursor name for this statement

Referenced by ODBCStatement::SetCursorName(), ODBCPreparedStatement::SetCursorName(), and ODBCCallableStatement::SetCursorName().

+ Here is the caller graph for this function:

void odbc::Statement::setEscapeProcessing ( bool  on)

Sets escape processing on or off

For PreparedStatements, the command has been parsed on creation, so this setting won't really have any effect.

Referenced by ODBCStatement::SetEscapeProcessing(), ODBCPreparedStatement::SetEscapeProcessing(), and ODBCCallableStatement::SetEscapeProcessing().

+ Here is the caller graph for this function:

void odbc::Statement::setFetchSize ( int  size)

Set the current fetch size for resultsets created by this statement

void odbc::Statement::setMaxFieldSize ( int  maxFieldSize)

Set the maximum field size for resultsets create by this statement

Referenced by ODBCStatement::SetMaxFieldSize(), ODBCPreparedStatement::SetMaxFieldSize(), and ODBCCallableStatement::SetMaxFieldSize().

+ Here is the caller graph for this function:

void odbc::Statement::setMaxRows ( int  maxRows)

Set the maximum number of rows to return in a resultset

Referenced by ODBCStatement::SetMaxRows(), ODBCPreparedStatement::SetMaxRows(), and ODBCCallableStatement::SetMaxRows().

+ Here is the caller graph for this function:

void odbc::Statement::setQueryTimeout ( int  seconds)

Set the query timeout for this statement

Referenced by ODBCStatement::SetQueryTimeout(), ODBCPreparedStatement::SetQueryTimeout(), and ODBCCallableStatement::SetQueryTimeout().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class Connection
friend

Definition at line 37 of file statement.h.

View newest version in sPHENIX GitHub at line 37 of file statement.h

friend class DatabaseMetaData
friend

Definition at line 39 of file statement.h.

View newest version in sPHENIX GitHub at line 39 of file statement.h

friend class ResultSet
friend

Definition at line 38 of file statement.h.

View newest version in sPHENIX GitHub at line 38 of file statement.h

Member Data Documentation

std::vector<ODBCXX_STRING> odbc::Statement::batches_
private

Definition at line 65 of file statement.h.

View newest version in sPHENIX GitHub at line 65 of file statement.h

Connection* odbc::Statement::connection_
protected

Definition at line 42 of file statement.h.

View newest version in sPHENIX GitHub at line 42 of file statement.h

ResultSet* odbc::Statement::currentResultSet_
private

Definition at line 51 of file statement.h.

View newest version in sPHENIX GitHub at line 51 of file statement.h

int odbc::Statement::fetchSize_
private

Definition at line 53 of file statement.h.

View newest version in sPHENIX GitHub at line 53 of file statement.h

SQLHSTMT odbc::Statement::hstmt_
protected

Definition at line 43 of file statement.h.

View newest version in sPHENIX GitHub at line 43 of file statement.h

int odbc::Statement::lastExecute_
protected

Definition at line 44 of file statement.h.

View newest version in sPHENIX GitHub at line 44 of file statement.h

int odbc::Statement::resultSetConcurrency_
private

Definition at line 55 of file statement.h.

View newest version in sPHENIX GitHub at line 55 of file statement.h

int odbc::Statement::resultSetType_
private

Definition at line 54 of file statement.h.

View newest version in sPHENIX GitHub at line 54 of file statement.h

StatementState odbc::Statement::state_
private

Definition at line 63 of file statement.h.

View newest version in sPHENIX GitHub at line 63 of file statement.h


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