NCBI C++ ToolKit
|
Search Toolkit Book for CStatementBase
#include <dbapi/driver/odbc/interfaces.hpp>
Public Member Functions | |
CStatementBase (CODBC_Connection &conn, const string &query) | |
CStatementBase (CODBC_Connection &conn, const string &cursor_name, const string &query) | |
~CStatementBase (void) | |
SQLHSTMT | GetHandle (void) const |
CODBC_Connection & | GetConnection (void) |
const CODBC_Connection & | GetConnection (void) const |
void | SetDbgInfo (const string &msg) |
const CODBC_Connection::TDbgInfo & | GetDbgInfo (void) const |
void | ReportErrors (void) const |
void | ReportError (CDB_Exception &ex) const |
CDBParams & | GetBindParams (void) |
Binding. More... | |
const CDBParams & | GetBindParams (void) const |
bool | CheckRC (int rc) const |
int | CheckSIE (int rc, const char *msg, unsigned int msg_num) const |
int | CheckSIENd (int rc, const char *msg, unsigned int msg_num) const |
bool | Close (void) const |
bool | Unbind (void) const |
bool | ResetParams (void) const |
bool | IsMultibyteClientEncoding (void) const |
EEncoding | GetClientEncoding (void) const |
![]() | |
CBaseCmd (impl::CConnection &conn, const string &query) | |
CBaseCmd (impl::CConnection &conn, const string &cursor_name, const string &query) | |
virtual | ~CBaseCmd (void) |
virtual bool | Send (void) |
Send command to the server. More... | |
virtual bool | Cancel (void) |
Cancel the command execution. More... | |
bool | WasCanceled (void) const |
virtual CDB_Result * | Result (void) |
Get result set. More... | |
virtual bool | HasMoreResults (void) const |
virtual bool | HasFailed (void) const |
void | DumpResults (void) |
Dump the results of the command if result processor is installed for this connection, it will be called for each result set. More... | |
virtual CDBParams & | GetDefineParams (void) |
Get meta-information about defined parameters. More... | |
const CDBParams * | GetLastParams (void) const |
bool | More (const string &query_text) |
Add more text to the language command. More... | |
const string & | GetQuery (void) const |
string | GetCmdName (void) const |
virtual void | SetHints (CTempString hints) |
Set hints by one call. More... | |
virtual void | AddHint (CDB_BCPInCmd::EBCP_Hints hint, unsigned int value) |
Add hint with value. More... | |
virtual void | AddOrderHint (CTempString columns) |
Add "ORDER" hint. More... | |
virtual bool | CommitBCPTrans (void) |
Complete batch – to store all rows transferred by far in this batch into the table. More... | |
virtual bool | EndBCP (void) |
Complete the BCP and store all rows transferred in last batch into the table. More... | |
unsigned int | GetRowsInCurrentBatch (void) const |
![]() | |
CCmdBase (impl::CConnection &conn) | |
virtual | ~CCmdBase () |
bool | WasSent (void) const |
![]() | |
virtual | ~CCommand (void) |
void | Release (void) |
Protected Member Functions | |
virtual int | RowCount (void) const |
Get the number of rows affected by the command Special case: negative on error or if there is no way that this command could ever affect any rows (like PRINT). More... | |
string | Type2String (const CDB_Object ¶m) const |
bool | x_BindParam_ODBC (const CDB_Object ¶m, CMemPot &bind_guard, SQLLEN *indicator_base, unsigned int pos) const |
SQLSMALLINT | x_GetCType (const CDB_Object ¶m) const |
SQLSMALLINT | x_GetSQLType (const CDB_Object ¶m) const |
SQLULEN | x_GetMaxDataSize (const CDB_Object ¶m) const |
SQLLEN | x_GetCurDataSize (const CDB_Object ¶m) const |
SQLLEN | x_GetIndicator (const CDB_Object ¶m) const |
SQLPOINTER | x_GetData (const CDB_Object ¶m, CMemPot &bind_guard) const |
![]() | |
void | DetachInterface (void) |
void | SetRecompile (bool recompile=true) |
Set the "recompile before execute" flag for the stored proc. More... | |
bool | NeedToRecompile (void) const |
virtual void | SetHasFailed (bool flag=true) |
const CDB_Params & | GetBindParamsImpl (void) const |
CDB_Params & | GetBindParamsImpl (void) |
const CDB_Params & | GetDefineParamsImpl (void) const |
CDB_Params & | GetDefineParamsImpl (void) |
virtual CDB_Result * | OpenCursor (void) |
Open the cursor. More... | |
virtual bool | Update (const string &table_name, const string &upd_query) |
Update the last fetched row. More... | |
virtual bool | UpdateBlob (unsigned int item_num, CDB_Stream &data, bool log_it=true) |
virtual CDB_SendDataCmd * | SendDataCmd (unsigned int item_num, size_t size, bool log_it=true, bool dump_results=true) |
virtual bool | Delete (const string &table_name) |
Delete the last fetched row. More... | |
virtual bool | CloseCursor (void) |
Close the cursor. More... | |
bool | CursorIsOpen (void) const |
void | SetCursorOpen (bool flag=true) |
bool | CursorIsDeclared (void) const |
void | SetCursorDeclared (bool flag=true) |
![]() | |
void | SetWasSent (bool flag=true) |
impl::CConnection & | GetConnImpl (void) const |
Protected Attributes | |
SQLLEN | m_RowCount |
Private Member Functions | |
void | x_Init (void) |
Private Attributes | |
SQLHSTMT | m_Cmd |
CODBC_Reporter | m_Reporter |
bool | m_IsActive |
Friends | |
class | CODBC_Connection |
Additional Inherited Members | |
![]() | |
static CDB_Result * | Create_Result (CResult &result) |
Definition at line 360 of file interfaces.hpp.
CStatementBase::CStatementBase | ( | CODBC_Connection & | conn, |
const string & | query | ||
) |
Definition at line 848 of file connection.cpp.
References x_Init().
CStatementBase::CStatementBase | ( | CODBC_Connection & | conn, |
const string & | cursor_name, | ||
const string & | query | ||
) |
Definition at line 858 of file connection.cpp.
References x_Init().
CStatementBase::~CStatementBase | ( | void | ) |
Definition at line 903 of file connection.cpp.
References GetConnection(), CODBC_Connection::m_ActiveStmt, m_Cmd, m_IsActive, NCBI_CATCH_ALL_X, NCBI_CURRENT_FUNCTION, NULL, ReportErrors(), SQL_HANDLE_STMT, SQL_SUCCESS, and SQLFreeHandle().
Definition at line 918 of file connection.cpp.
References DATABASE_DRIVER_ERROR, GetDbgInfo(), ReportErrors(), SQL_ERROR, SQL_INVALID_HANDLE, SQL_SUCCESS, and SQL_SUCCESS_WITH_INFO.
Referenced by Close(), ResetParams(), and Unbind().
Definition at line 940 of file connection.cpp.
References DATABASE_DRIVER_ERROR, GetDbgInfo(), msg(), ReportErrors(), SQL_ERROR, SQL_SUCCESS, and SQL_SUCCESS_WITH_INFO.
Referenced by CODBC_LangCmd::CloseCursor(), CODBC_LangCmd::Result(), CODBC_RPCCmd::Result(), CODBC_SendDataCmd::Result(), CODBC_LangCmd::SetCursorName(), and x_BindParam_ODBC().
Definition at line 970 of file connection.cpp.
References DATABASE_DRIVER_ERROR, GetDbgInfo(), msg(), ReportErrors(), SQL_ERROR, SQL_SUCCESS, and SQL_SUCCESS_WITH_INFO.
bool CStatementBase::Close | ( | void | ) | const |
Definition at line 1608 of file connection.cpp.
References CheckRC(), CODBC_Connection::GetCancelTimeout(), GetConnection(), GetHandle(), CODBC_Connection::GetTimeout(), m_Cmd, result, SQL_ATTR_QUERY_TIMEOUT, SQL_CLOSE, SQLFreeStmt(), and SQLSetStmtAttr().
Referenced by CODBC_LangCmd::Cancel(), CODBC_RPCCmd::Cancel(), CODBC_RowResult::Close(), and CODBC_SendDataCmd::xCancel().
|
inlinevirtual |
Binding.
Get meta-information about binded parameters.
Reimplemented from impl::CBaseCmd.
Reimplemented in CODBC_CursorCmdBase, and CODBC_RPCCmd.
Definition at line 404 of file interfaces.hpp.
Referenced by CODBC_CursorCmdBase::GetBindParams().
Definition at line 408 of file interfaces.hpp.
|
inline |
Definition at line 435 of file interfaces.hpp.
References impl::CConnection::GetClientEncoding(), and GetConnection().
Referenced by CODBC_BCPInCmd::CODBC_BCPInCmd(), CODBC_RowResult::GetClientEncoding(), CODBC_LangCmd::Send(), CODBC_RPCCmd::Send(), CODBC_SendDataCmd::SendChunk(), CODBC_LangCmd::SetCursorName(), and x_GetData().
|
inline |
Definition at line 373 of file interfaces.hpp.
References impl::CCmdBase::GetConnImpl().
Referenced by Close(), CODBC_CursorCmdExpl::CloseCursor(), CODBC_CursorCmd::Delete(), CODBC_CursorCmdExpl::Delete(), GetClientEncoding(), CODBC_RowResult::GetConnection(), IsMultibyteClientEncoding(), CODBC_CursorCmdExpl::OpenCursor(), CODBC_CursorCmd::SendDataCmd(), CODBC_CursorCmdExpl::SendDataCmd(), CODBC_CursorCmd::Update(), CODBC_CursorCmdExpl::Update(), CODBC_CursorCmd::UpdateBlob(), CODBC_CursorCmdExpl::UpdateBlob(), x_Init(), CODBC_BCPInCmd::~CODBC_BCPInCmd(), CODBC_CursorCmd::~CODBC_CursorCmd(), CODBC_CursorCmdExpl::~CODBC_CursorCmdExpl(), CODBC_LangCmd::~CODBC_LangCmd(), CODBC_RPCCmd::~CODBC_RPCCmd(), CODBC_SendDataCmd::~CODBC_SendDataCmd(), and ~CStatementBase().
|
inline |
Definition at line 377 of file interfaces.hpp.
References impl::CCmdBase::GetConnImpl().
|
inline |
Definition at line 388 of file interfaces.hpp.
References CODBC_Reporter::GetDbgInfo(), and m_Reporter.
Referenced by CheckRC(), CheckSIE(), CheckSIENd(), CODBC_CursorCmdExpl::CloseCursor(), CODBC_BCPInCmd::CODBC_BCPInCmd(), CODBC_SendDataCmd::CODBC_SendDataCmd(), CODBC_BCPInCmd::CommitBCPTrans(), CODBC_CursorCmd::Delete(), CODBC_CursorCmdExpl::Delete(), CODBC_BCPInCmd::EndBCP(), CODBC_RowResult::GetDbgInfo(), CODBC_CursorResult::GetDbgInfo(), CODBC_CursorCmd::OpenCursor(), CODBC_CursorCmdExpl::OpenCursor(), CODBC_LangCmd::Result(), CODBC_RPCCmd::Result(), CODBC_SendDataCmd::Result(), CODBC_LangCmd::Send(), CODBC_RPCCmd::Send(), CODBC_BCPInCmd::Send(), CODBC_SendDataCmd::SendChunk(), CODBC_CursorCmd::Update(), CODBC_CursorCmdExpl::Update(), CODBC_LangCmd::x_AssignParams(), CODBC_LangCmd::xCheck4MoreResults(), CODBC_RPCCmd::xCheck4MoreResults(), and CODBC_SendDataCmd::xCheck4MoreResults().
|
inline |
Definition at line 369 of file interfaces.hpp.
References m_Cmd.
Referenced by Close(), CODBC_LangCmd::CloseCursor(), CODBC_RowResult::GetHandle(), CODBC_LangCmd::Result(), CODBC_RPCCmd::Result(), CODBC_SendDataCmd::Result(), CODBC_LangCmd::Send(), CODBC_RPCCmd::Send(), CODBC_SendDataCmd::SendChunk(), CODBC_LangCmd::SetCursorName(), x_BindParam_ODBC(), x_Init(), CODBC_LangCmd::xCheck4MoreResults(), CODBC_RPCCmd::xCheck4MoreResults(), and CODBC_SendDataCmd::xCheck4MoreResults().
|
inline |
Definition at line 431 of file interfaces.hpp.
References GetConnection(), and impl::CConnection::IsMultibyteClientEncoding().
Referenced by Type2String(), CODBC_BCPInCmd::x_AssignParams(), x_GetCType(), x_GetMaxDataSize(), and x_GetSQLType().
|
inline |
Definition at line 399 of file interfaces.hpp.
References m_Reporter, and CODBC_Reporter::ReportError().
Referenced by CODBC_RowResult::ReportError(), and CODBC_CursorResult::ReportError().
|
inline |
Definition at line 393 of file interfaces.hpp.
References m_Reporter, and CODBC_Reporter::ReportErrors().
Referenced by CheckRC(), CheckSIE(), CheckSIENd(), CODBC_BCPInCmd::CODBC_BCPInCmd(), CODBC_BCPInCmd::CommitBCPTrans(), CODBC_BCPInCmd::EndBCP(), CODBC_RowResult::ReportErrors(), CODBC_LangCmd::Send(), CODBC_RPCCmd::Send(), CODBC_BCPInCmd::Send(), CODBC_SendDataCmd::SendChunk(), CODBC_BCPInCmd::x_AssignParams(), x_Init(), CODBC_LangCmd::xCheck4MoreResults(), CODBC_RPCCmd::xCheck4MoreResults(), CODBC_SendDataCmd::xCheck4MoreResults(), and ~CStatementBase().
|
inline |
Definition at line 426 of file interfaces.hpp.
References CheckRC(), m_Cmd, SQL_RESET_PARAMS, and SQLFreeStmt().
Referenced by CODBC_LangCmd::Cancel(), CODBC_RPCCmd::Cancel(), CODBC_LangCmd::Send(), CODBC_RPCCmd::Send(), and CODBC_SendDataCmd::xCancel().
|
protectedvirtual |
Get the number of rows affected by the command Special case: negative on error or if there is no way that this command could ever affect any rows (like PRINT).
Implements impl::CBaseCmd.
Reimplemented in CODBC_BCPInCmd, CODBC_CursorCmdBase, CODBC_RPCCmd, and CODBC_LangCmd.
Definition at line 1602 of file connection.cpp.
References m_RowCount.
Definition at line 383 of file interfaces.hpp.
References m_Reporter, msg(), and CODBC_Reporter::SetExtraMsg().
Referenced by CODBC_BCPInCmd::CODBC_BCPInCmd(), CODBC_CursorCmdBase::CODBC_CursorCmdBase(), CODBC_LangCmd::CODBC_LangCmd(), and CODBC_RPCCmd::CODBC_RPCCmd().
|
protected |
Definition at line 1001 of file connection.cpp.
References eDB_BigDateTime, eDB_BigInt, eDB_Binary, eDB_Bit, eDB_Char, eDB_DateTime, eDB_Double, eDB_Float, eDB_Image, eDB_Int, eDB_LongBinary, eDB_LongChar, eDB_SmallDateTime, eDB_SmallInt, eDB_Text, eDB_TinyInt, eDB_VarBinary, eDB_VarBinaryMax, eDB_VarChar, eDB_VarCharMax, CDB_BigDateTime::eSyntax_Microsoft, CDB_Object::GetType(), and IsMultibyteClientEncoding().
Referenced by CODBC_LangCmd::x_AssignParams(), and CODBC_RPCCmd::x_AssignParams().
|
inline |
Definition at line 422 of file interfaces.hpp.
References CheckRC(), m_Cmd, SQL_UNBIND, and SQLFreeStmt().
|
protected |
Definition at line 1098 of file connection.cpp.
References CheckSIE(), eDB_BigDateTime, eDB_Bit, eDB_DateTime, eDB_Image, eDB_Numeric, eDB_Text, eDB_UnsupportedType, GetHandle(), CDB_Object::GetType(), SQL_PARAM_INPUT, SQLBindParameter(), x_GetCType(), x_GetCurDataSize(), x_GetData(), x_GetIndicator(), x_GetMaxDataSize(), and x_GetSQLType().
Referenced by CODBC_LangCmd::x_AssignParams(), and CODBC_RPCCmd::x_AssignParams().
|
protected |
Definition at line 1145 of file connection.cpp.
References eDB_BigDateTime, eDB_BigInt, eDB_Binary, eDB_Char, eDB_DateTime, eDB_Double, eDB_Float, eDB_Int, eDB_LongBinary, eDB_LongChar, eDB_SmallDateTime, eDB_SmallInt, eDB_TinyInt, eDB_VarBinary, eDB_VarBinaryMax, eDB_VarChar, eDB_VarCharMax, CDB_Object::GetType(), IsMultibyteClientEncoding(), SQL_C_BINARY, SQL_C_CHAR, SQL_C_DOUBLE, SQL_C_FLOAT, SQL_C_SBIGINT, SQL_C_SLONG, SQL_C_SSHORT, SQL_C_TYPE_TIMESTAMP, SQL_C_UTINYINT, SQL_C_WCHAR, and type.
Referenced by x_BindParam_ODBC().
|
protected |
Definition at line 1380 of file connection.cpp.
References eDB_BigDateTime, eDB_BigInt, eDB_Binary, eDB_Char, eDB_DateTime, eDB_Double, eDB_Float, eDB_Int, eDB_LongBinary, eDB_LongChar, eDB_SmallDateTime, eDB_SmallInt, eDB_TinyInt, eDB_VarBinary, eDB_VarBinaryMax, eDB_VarChar, eDB_VarCharMax, CDB_Object::GetType(), ncbi::grid::netcache::search::fields::size, SQLLEN, and x_GetMaxDataSize().
Referenced by x_BindParam_ODBC().
|
protected |
Definition at line 1461 of file connection.cpp.
References _VERIFY, CMemPot::Alloc(), CUtf8::AsUTF8(), data, tagTIMESTAMP_STRUCT::day, eDB_BigDateTime, eDB_BigInt, eDB_Binary, eDB_Char, eDB_DateTime, eDB_Double, eDB_Float, eDB_Int, eDB_LongBinary, eDB_LongChar, eDB_SmallDateTime, eDB_SmallInt, eDB_TinyInt, eDB_VarBinary, eDB_VarBinaryMax, eDB_VarChar, eDB_VarCharMax, tagTIMESTAMP_STRUCT::fraction, AutoArray< X, Del >::get(), GetClientEncoding(), CDB_Object::GetType(), tagTIMESTAMP_STRUCT::hour, CDB_Object::IsNULL(), tagTIMESTAMP_STRUCT::minute, tagTIMESTAMP_STRUCT::month, CDB_Stream::MoveTo(), n, NULL, CDB_Stream::Read(), AutoArray< X, Del >::reset(), tagTIMESTAMP_STRUCT::second, CDB_Stream::Size(), t, and tagTIMESTAMP_STRUCT::year.
Referenced by x_BindParam_ODBC().
|
protected |
Definition at line 1424 of file connection.cpp.
References eDB_BigDateTime, eDB_Binary, eDB_Char, eDB_DateTime, eDB_LongBinary, eDB_LongChar, eDB_SmallDateTime, eDB_VarBinary, eDB_VarBinaryMax, eDB_VarChar, eDB_VarCharMax, CDB_Object::GetType(), CDB_Object::IsNULL(), SQL_NULL_DATA, and x_GetMaxDataSize().
Referenced by x_BindParam_ODBC().
|
protected |
Definition at line 1283 of file connection.cpp.
References eDB_BigDateTime, eDB_BigInt, eDB_Binary, eDB_Char, eDB_DateTime, eDB_Double, eDB_Float, eDB_Int, eDB_LongBinary, eDB_LongChar, eDB_SmallDateTime, eDB_SmallInt, eDB_TinyInt, eDB_VarBinary, eDB_VarBinaryMax, eDB_VarChar, eDB_VarCharMax, CDB_Object::GetType(), IsMultibyteClientEncoding(), kMax_UInt, ncbi::grid::netcache::search::fields::size, and SQLULEN.
Referenced by x_BindParam_ODBC(), x_GetCurDataSize(), and x_GetIndicator().
|
protected |
Definition at line 1206 of file connection.cpp.
References eDB_BigDateTime, eDB_BigInt, eDB_Binary, eDB_Char, eDB_DateTime, eDB_Double, eDB_Float, eDB_Int, eDB_LongBinary, eDB_LongChar, eDB_SmallDateTime, eDB_SmallInt, eDB_TinyInt, eDB_VarBinary, eDB_VarBinaryMax, eDB_VarChar, eDB_VarCharMax, CDB_Object::GetType(), IsMultibyteClientEncoding(), SQL_FLOAT, SQL_INTEGER, SQL_LONGVARBINARY, SQL_LONGVARCHAR, SQL_NUMERIC, SQL_REAL, SQL_SMALLINT, SQL_TINYINT, SQL_TYPE_TIMESTAMP, SQL_UNKNOWN_TYPE, SQL_VARBINARY, SQL_VARCHAR, SQL_WLONGVARCHAR, SQL_WVARCHAR, and type.
Referenced by x_BindParam_ODBC().
|
private |
Definition at line 871 of file connection.cpp.
References GetConnection(), GetHandle(), CODBC_Connection::GetTimeout(), CODBC_Connection::m_ActiveStmt, m_Cmd, m_IsActive, m_Reporter, CODBC_Connection::ReportErrors(), ReportErrors(), CODBC_Reporter::SetHandle(), SQL_ATTR_QUERY_TIMEOUT, SQL_ERROR, SQL_HANDLE_STMT, SQL_INVALID_HANDLE, SQL_SUCCESS_WITH_INFO, SQLAllocHandle(), and SQLSetStmtAttr().
Referenced by CStatementBase().
|
friend |
Definition at line 362 of file interfaces.hpp.
|
private |
Definition at line 462 of file interfaces.hpp.
Referenced by Close(), GetHandle(), ResetParams(), Unbind(), x_Init(), and ~CStatementBase().
|
private |
Definition at line 464 of file interfaces.hpp.
Referenced by x_Init(), CODBC_Connection::~CODBC_Connection(), and ~CStatementBase().
|
private |
Definition at line 463 of file interfaces.hpp.
Referenced by GetDbgInfo(), ReportError(), ReportErrors(), SetDbgInfo(), and x_Init().
|
protected |
Definition at line 456 of file interfaces.hpp.
Referenced by CODBC_BCPInCmd::CODBC_BCPInCmd(), CODBC_LangCmd::Result(), CODBC_RPCCmd::Result(), CODBC_SendDataCmd::Result(), RowCount(), CODBC_LangCmd::RowCount(), CODBC_RPCCmd::RowCount(), CODBC_CursorCmdBase::RowCount(), CODBC_BCPInCmd::RowCount(), CODBC_LangCmd::Send(), and CODBC_RPCCmd::Send().