NCBI C++ ToolKit
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
impl::CBaseCmd Class Referenceabstract

Search Toolkit Book for impl::CBaseCmd

#include <dbapi/driver/impl/dbapi_impl_cmd.hpp>

+ Inheritance diagram for impl::CBaseCmd:
+ Collaboration diagram for impl::CBaseCmd:

Public Member Functions

 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_ResultResult (void)
 Get result set. More...
 
virtual bool HasMoreResults (void) const
 
virtual bool HasFailed (void) const
 
virtual int RowCount (void) const =0
 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...
 
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 CDBParamsGetBindParams (void)
 Binding. More...
 
virtual CDBParamsGetDefineParams (void)
 Get meta-information about defined parameters. More...
 
const CDBParamsGetLastParams (void) const
 
bool More (const string &query_text)
 Add more text to the language command. More...
 
const stringGetQuery (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
 
- Public Member Functions inherited from impl::CCmdBase
 CCmdBase (impl::CConnection &conn)
 
virtual ~CCmdBase ()
 
bool WasSent (void) const
 
- Public Member Functions inherited from impl::CCommand
virtual ~CCommand (void)
 
void Release (void)
 

Protected Member Functions

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_ParamsGetBindParamsImpl (void) const
 
CDB_ParamsGetBindParamsImpl (void)
 
const CDB_ParamsGetDefineParamsImpl (void) const
 
CDB_ParamsGetDefineParamsImpl (void)
 
virtual CDB_ResultOpenCursor (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_SendDataCmdSendDataCmd (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)
 
- Protected Member Functions inherited from impl::CCmdBase
void SetWasSent (bool flag=true)
 
impl::CConnectionGetConnImpl (void) const
 

Private Member Functions

void AttachTo (CDB_LangCmd *interface)
 
void AttachTo (CDB_RPCCmd *interface)
 
void AttachTo (CDB_BCPInCmd *interface)
 
void AttachTo (CDB_CursorCmd *interface)
 
void SaveInParams (void)
 

Private Attributes

CInterfaceHook< CDB_LangCmdm_InterfaceLang
 
CInterfaceHook< CDB_RPCCmdm_InterfaceRPC
 
CInterfaceHook< CDB_BCPInCmdm_InterfaceBCPIn
 
CInterfaceHook< CDB_CursorCmdm_InterfaceCursor
 
string m_Query
 
CDB_Params m_BindParams
 
CDBBindedParams m_InParams
 
CDB_Params m_DefineParams
 
CDBBindedParams m_OutParams
 
bool m_Recompile
 
bool m_HasFailed
 
bool m_AtStartOfBatch
 
bool m_IsOpen
 
bool m_IsDeclared
 
const string m_CmdName
 
unsigned int m_RowsSent
 
unsigned int m_RowsSentAtBatchStart
 
unsigned int m_BatchesSent
 
unique_ptr< CDBParamsm_LastInParams
 

Friends

class ncbi::CDB_LangCmd
 
class ncbi::CDB_RPCCmd
 
class ncbi::CDB_BCPInCmd
 
class ncbi::CDB_CursorCmd
 

Additional Inherited Members

- Static Public Member Functions inherited from impl::CCommand
static CDB_ResultCreate_Result (CResult &result)
 

Detailed Description

Definition at line 106 of file dbapi_impl_cmd.hpp.

Constructor & Destructor Documentation

◆ CBaseCmd() [1/2]

impl::CBaseCmd::CBaseCmd ( impl::CConnection conn,
const string query 
)

Definition at line 68 of file dbapi_impl_cmd.cpp.

◆ CBaseCmd() [2/2]

impl::CBaseCmd::CBaseCmd ( impl::CConnection conn,
const string cursor_name,
const string query 
)

Definition at line 85 of file dbapi_impl_cmd.cpp.

◆ ~CBaseCmd()

impl::CBaseCmd::~CBaseCmd ( void  )
virtual

Definition at line 104 of file dbapi_impl_cmd.cpp.

Member Function Documentation

◆ AddHint()

void impl::CBaseCmd::AddHint ( CDB_BCPInCmd::EBCP_Hints  hint,
unsigned int  value 
)
virtual

Add hint with value.

Reimplemented in CTL_BCPInCmd.

Definition at line 187 of file dbapi_impl_cmd.cpp.

References _ASSERT.

Referenced by CDB_BCPInCmd::AddHint().

◆ AddOrderHint()

void impl::CBaseCmd::AddOrderHint ( CTempString  columns)
virtual

Add "ORDER" hint.

Reimplemented in CTL_BCPInCmd.

Definition at line 194 of file dbapi_impl_cmd.cpp.

References _ASSERT.

Referenced by CDB_BCPInCmd::AddOrderHint().

◆ AttachTo() [1/4]

void impl::CBaseCmd::AttachTo ( CDB_BCPInCmd interface)
private

Definition at line 293 of file dbapi_impl_cmd.cpp.

References m_InterfaceBCPIn.

◆ AttachTo() [2/4]

void impl::CBaseCmd::AttachTo ( CDB_CursorCmd interface)
private

Definition at line 299 of file dbapi_impl_cmd.cpp.

References m_InterfaceCursor.

◆ AttachTo() [3/4]

void impl::CBaseCmd::AttachTo ( CDB_LangCmd interface)
private

◆ AttachTo() [4/4]

void impl::CBaseCmd::AttachTo ( CDB_RPCCmd interface)
private

Definition at line 286 of file dbapi_impl_cmd.cpp.

References m_InterfaceRPC.

◆ Cancel()

bool impl::CBaseCmd::Cancel ( void  )
virtual

Cancel the command execution.

Reimplemented in CTL_LRCmd, CODBC_SendDataCmd, CODBC_BCPInCmd, CODBC_RPCCmd, CODBC_LangCmd, CTL_SendDataCmd, CTL_BCPInCmd, and CMySQL_LangCmd.

Definition at line 130 of file dbapi_impl_cmd.cpp.

References _ASSERT.

Referenced by CDB_LangCmd::Cancel(), CDB_RPCCmd::Cancel(), and CDB_BCPInCmd::Cancel().

◆ CloseCursor()

bool impl::CBaseCmd::CloseCursor ( void  )
protectedvirtual

Close the cursor.

Return FALSE if the cursor is closed already (or not opened yet)

Reimplemented in CODBC_CursorCmdExpl, CODBC_CursorCmd, CODBC_LangCmd, CTL_CursorCmdExpl, and CTL_CursorCmd.

Definition at line 261 of file dbapi_impl_cmd.cpp.

References _ASSERT.

Referenced by CDB_CursorCmd::Close().

◆ CommitBCPTrans()

bool impl::CBaseCmd::CommitBCPTrans ( void  )
virtual

Complete batch – to store all rows transferred by far in this batch into the table.

Reimplemented in CODBC_BCPInCmd, and CTL_BCPInCmd.

Definition at line 201 of file dbapi_impl_cmd.cpp.

Referenced by CDB_BCPInCmd::CompleteBatch().

◆ CursorIsDeclared()

bool impl::CBaseCmd::CursorIsDeclared ( void  ) const
inlineprotected

◆ CursorIsOpen()

bool impl::CBaseCmd::CursorIsOpen ( void  ) const
inlineprotected

◆ Delete()

bool impl::CBaseCmd::Delete ( const string table_name)
protectedvirtual

Delete the last fetched row.

NOTE: the cursor must be declared for delete in CDB_Connection::Cursor()

Reimplemented in CODBC_CursorCmdExpl, CODBC_CursorCmd, CTL_CursorCmdExpl, and CTL_CursorCmd.

Definition at line 253 of file dbapi_impl_cmd.cpp.

References _ASSERT.

Referenced by CDB_CursorCmd::Delete().

◆ DetachInterface()

void impl::CBaseCmd::DetachInterface ( void  )
protected

◆ DumpResults()

void impl::CBaseCmd::DumpResults ( void  )

Dump the results of the command if result processor is installed for this connection, it will be called for each result set.

Definition at line 158 of file dbapi_impl_cmd.cpp.

References impl::CCmdBase::GetConnImpl(), impl::CConnection::GetResultProcessor(), HasMoreResults(), CDB_ResultProcessor::ProcessResult(), and Result().

Referenced by CTL_SendDataCmd::Close(), CDB_LangCmd::DumpResults(), CDB_RPCCmd::DumpResults(), CODBC_CursorCmdExpl::OpenCursor(), and CTL_SendDataCmd::SendChunk().

◆ EndBCP()

bool impl::CBaseCmd::EndBCP ( void  )
virtual

Complete the BCP and store all rows transferred in last batch into the table.

Reimplemented in CODBC_BCPInCmd, and CTL_BCPInCmd.

Definition at line 208 of file dbapi_impl_cmd.cpp.

Referenced by CDB_BCPInCmd::CompleteBCP().

◆ GetBindParams()

CDBParams & impl::CBaseCmd::GetBindParams ( void  )
virtual

◆ GetBindParamsImpl() [1/2]

CDB_Params& impl::CBaseCmd::GetBindParamsImpl ( void  )
inlineprotected

Definition at line 231 of file dbapi_impl_cmd.hpp.

References m_BindParams.

◆ GetBindParamsImpl() [2/2]

const CDB_Params& impl::CBaseCmd::GetBindParamsImpl ( void  ) const
inlineprotected

◆ GetCmdName()

string impl::CBaseCmd::GetCmdName ( void  ) const
inline

◆ GetDefineParams()

CDBParams & impl::CBaseCmd::GetDefineParams ( void  )
virtual

Get meta-information about defined parameters.

Reimplemented in CODBC_CursorCmdBase.

Definition at line 116 of file dbapi_impl_cmd.cpp.

References m_OutParams.

Referenced by CODBC_CursorCmdBase::GetDefineParams(), CDB_LangCmd::GetDefineParams(), CDB_RPCCmd::GetDefineParams(), and CDB_CursorCmd::GetDefineParams().

◆ GetDefineParamsImpl() [1/2]

CDB_Params& impl::CBaseCmd::GetDefineParamsImpl ( void  )
inlineprotected

Definition at line 241 of file dbapi_impl_cmd.hpp.

References m_DefineParams.

◆ GetDefineParamsImpl() [2/2]

const CDB_Params& impl::CBaseCmd::GetDefineParamsImpl ( void  ) const
inlineprotected

Definition at line 237 of file dbapi_impl_cmd.hpp.

References m_DefineParams.

◆ GetLastParams()

const CDBParams* impl::CBaseCmd::GetLastParams ( void  ) const
inline

◆ GetQuery()

const string& impl::CBaseCmd::GetQuery ( void  ) const
inline

◆ GetRowsInCurrentBatch()

unsigned int impl::CBaseCmd::GetRowsInCurrentBatch ( void  ) const
inline

Definition at line 203 of file dbapi_impl_cmd.hpp.

References m_RowsSent, and m_RowsSentAtBatchStart.

Referenced by CDB_BCPInCmd::CompleteBatch().

◆ HasFailed()

bool impl::CBaseCmd::HasFailed ( void  ) const
virtual

◆ HasMoreResults()

bool impl::CBaseCmd::HasMoreResults ( void  ) const
virtual

◆ More()

bool impl::CBaseCmd::More ( const string query_text)
inline

Add more text to the language command.

Definition at line 165 of file dbapi_impl_cmd.hpp.

References m_Query.

Referenced by CDB_LangCmd::More().

◆ NeedToRecompile()

bool impl::CBaseCmd::NeedToRecompile ( void  ) const
inlineprotected

Definition at line 216 of file dbapi_impl_cmd.hpp.

References m_Recompile.

Referenced by CTL_RPCCmd::Send(), and CODBC_RPCCmd::Send().

◆ OpenCursor()

CDB_Result * impl::CBaseCmd::OpenCursor ( void  )
protectedvirtual

Open the cursor.

Return NULL if cursor resulted in no data. Throw exception on error.

Reimplemented in CODBC_CursorCmdExpl, CODBC_CursorCmd, CTL_CursorCmdExpl, and CTL_CursorCmd.

Definition at line 215 of file dbapi_impl_cmd.cpp.

References _ASSERT, and NULL.

Referenced by CDB_CursorCmd::Open().

◆ Result()

CDB_Result * impl::CBaseCmd::Result ( void  )
virtual

Get result set.

Reimplemented in CODBC_SendDataCmd, CODBC_RPCCmd, CODBC_LangCmd, CTL_SendDataCmd, CTL_RPCCmd, CTL_LangCmd, and CMySQL_LangCmd.

Definition at line 145 of file dbapi_impl_cmd.cpp.

References NULL.

Referenced by DumpResults(), CDB_LangCmd::Result(), and CDB_RPCCmd::Result().

◆ RowCount()

virtual int impl::CBaseCmd::RowCount ( void  ) const
pure virtual

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).

Implemented in CODBC_BCPInCmd, CODBC_CursorCmdBase, CODBC_RPCCmd, CODBC_LangCmd, CStatementBase, CTL_SendDataCmd, CTL_BCPInCmd, CTL_CursorCmdExpl, CTL_CursorCmd, CTL_RPCCmd, CTL_LangCmd, and CMySQL_LangCmd.

Referenced by CDB_LangCmd::RowCount(), CDB_RPCCmd::RowCount(), and CDB_CursorCmd::RowCount().

◆ SaveInParams()

void impl::CBaseCmd::SaveInParams ( void  )
inlineprivate

◆ Send()

bool impl::CBaseCmd::Send ( void  )
virtual

Send command to the server.

Reimplemented in CODBC_BCPInCmd, CODBC_RPCCmd, CODBC_LangCmd, CTL_BCPInCmd, CTL_RPCCmd, CTL_LangCmd, and CMySQL_LangCmd.

Definition at line 122 of file dbapi_impl_cmd.cpp.

References _ASSERT.

Referenced by CDB_LangCmd::Send(), CDB_RPCCmd::Send(), and CDB_BCPInCmd::SendRow().

◆ SendDataCmd()

CDB_SendDataCmd * impl::CBaseCmd::SendDataCmd ( unsigned int  item_num,
size_t  size,
bool  log_it = true,
bool  dump_results = true 
)
protectedvirtual

Reimplemented in CODBC_CursorCmdExpl, CODBC_CursorCmd, CTL_CursorCmdExpl, and CTL_CursorCmd.

Definition at line 241 of file dbapi_impl_cmd.cpp.

References _ASSERT, and NULL.

Referenced by CDB_CursorCmd::SendDataCmd().

◆ SetCursorDeclared()

void impl::CBaseCmd::SetCursorDeclared ( bool  flag = true)
inlineprotected

◆ SetCursorOpen()

void impl::CBaseCmd::SetCursorOpen ( bool  flag = true)
inlineprotected

◆ SetHasFailed()

virtual void impl::CBaseCmd::SetHasFailed ( bool  flag = true)
inlineprotectedvirtual

◆ SetHints()

void impl::CBaseCmd::SetHints ( CTempString  hints)
virtual

Set hints by one call.

Reimplemented in CTL_BCPInCmd.

Definition at line 180 of file dbapi_impl_cmd.cpp.

References _ASSERT.

Referenced by CDB_BCPInCmd::SetHints().

◆ SetRecompile()

void impl::CBaseCmd::SetRecompile ( bool  recompile = true)
inlineprotected

Set the "recompile before execute" flag for the stored proc.

Definition at line 212 of file dbapi_impl_cmd.hpp.

References m_Recompile.

Referenced by CDB_RPCCmd::SetRecompile().

◆ Update()

bool impl::CBaseCmd::Update ( const string table_name,
const string upd_query 
)
protectedvirtual

Update the last fetched row.

NOTE: the cursor must be declared for update in CDB_Connection::Cursor()

Reimplemented in CODBC_CursorCmdExpl, CODBC_CursorCmd, CTL_CursorCmdExpl, and CTL_CursorCmd.

Definition at line 222 of file dbapi_impl_cmd.cpp.

References _ASSERT.

Referenced by CDB_CursorCmd::Update().

◆ UpdateBlob()

bool impl::CBaseCmd::UpdateBlob ( unsigned int  item_num,
CDB_Stream data,
bool  log_it = true 
)
protectedvirtual

Reimplemented in CODBC_CursorCmdExpl, CODBC_CursorCmd, CTL_CursorCmdExpl, and CTL_CursorCmd.

Definition at line 230 of file dbapi_impl_cmd.cpp.

References _ASSERT.

Referenced by CDB_CursorCmd::UpdateBlob().

◆ WasCanceled()

bool impl::CBaseCmd::WasCanceled ( void  ) const
inline

Definition at line 128 of file dbapi_impl_cmd.hpp.

References impl::CCmdBase::WasSent().

Referenced by CDB_LangCmd::WasCanceled(), and CDB_RPCCmd::WasCanceled().

Friends And Related Function Documentation

◆ ncbi::CDB_BCPInCmd

friend class ncbi::CDB_BCPInCmd
friend

Definition at line 111 of file dbapi_impl_cmd.hpp.

◆ ncbi::CDB_CursorCmd

friend class ncbi::CDB_CursorCmd
friend

Definition at line 112 of file dbapi_impl_cmd.hpp.

◆ ncbi::CDB_LangCmd

friend class ncbi::CDB_LangCmd
friend

Definition at line 109 of file dbapi_impl_cmd.hpp.

◆ ncbi::CDB_RPCCmd

friend class ncbi::CDB_RPCCmd
friend

Definition at line 110 of file dbapi_impl_cmd.hpp.

Member Data Documentation

◆ m_AtStartOfBatch

bool impl::CBaseCmd::m_AtStartOfBatch
private

Definition at line 322 of file dbapi_impl_cmd.hpp.

Referenced by CDB_BCPInCmd::CompleteBatch(), and CDB_BCPInCmd::SendRow().

◆ m_BatchesSent

unsigned int impl::CBaseCmd::m_BatchesSent
private

Definition at line 331 of file dbapi_impl_cmd.hpp.

Referenced by CDB_BCPInCmd::CompleteBatch(), and CDB_BCPInCmd::CompleteBCP().

◆ m_BindParams

CDB_Params impl::CBaseCmd::m_BindParams
private

Definition at line 316 of file dbapi_impl_cmd.hpp.

Referenced by GetBindParamsImpl().

◆ m_CmdName

const string impl::CBaseCmd::m_CmdName
private

Definition at line 327 of file dbapi_impl_cmd.hpp.

Referenced by GetCmdName().

◆ m_DefineParams

CDB_Params impl::CBaseCmd::m_DefineParams
private

Definition at line 318 of file dbapi_impl_cmd.hpp.

Referenced by GetDefineParamsImpl().

◆ m_HasFailed

bool impl::CBaseCmd::m_HasFailed
private

Definition at line 321 of file dbapi_impl_cmd.hpp.

Referenced by HasFailed(), and SetHasFailed().

◆ m_InParams

CDBBindedParams impl::CBaseCmd::m_InParams
private

Definition at line 317 of file dbapi_impl_cmd.hpp.

Referenced by GetBindParams(), GetLastParams(), and SaveInParams().

◆ m_InterfaceBCPIn

CInterfaceHook<CDB_BCPInCmd> impl::CBaseCmd::m_InterfaceBCPIn
private

Definition at line 312 of file dbapi_impl_cmd.hpp.

Referenced by AttachTo(), and DetachInterface().

◆ m_InterfaceCursor

CInterfaceHook<CDB_CursorCmd> impl::CBaseCmd::m_InterfaceCursor
private

Definition at line 313 of file dbapi_impl_cmd.hpp.

Referenced by AttachTo(), and DetachInterface().

◆ m_InterfaceLang

CInterfaceHook<CDB_LangCmd> impl::CBaseCmd::m_InterfaceLang
private

Definition at line 310 of file dbapi_impl_cmd.hpp.

Referenced by AttachTo(), and DetachInterface().

◆ m_InterfaceRPC

CInterfaceHook<CDB_RPCCmd> impl::CBaseCmd::m_InterfaceRPC
private

Definition at line 311 of file dbapi_impl_cmd.hpp.

Referenced by AttachTo(), and DetachInterface().

◆ m_IsDeclared

bool impl::CBaseCmd::m_IsDeclared
private

Definition at line 326 of file dbapi_impl_cmd.hpp.

Referenced by CursorIsDeclared(), and SetCursorDeclared().

◆ m_IsOpen

bool impl::CBaseCmd::m_IsOpen
private

Definition at line 325 of file dbapi_impl_cmd.hpp.

Referenced by CursorIsOpen(), and SetCursorOpen().

◆ m_LastInParams

unique_ptr<CDBParams> impl::CBaseCmd::m_LastInParams
private

Definition at line 333 of file dbapi_impl_cmd.hpp.

Referenced by GetBindParams(), GetLastParams(), and SaveInParams().

◆ m_OutParams

CDBBindedParams impl::CBaseCmd::m_OutParams
private

Definition at line 319 of file dbapi_impl_cmd.hpp.

Referenced by GetDefineParams().

◆ m_Query

string impl::CBaseCmd::m_Query
private

Definition at line 315 of file dbapi_impl_cmd.hpp.

Referenced by GetQuery(), and More().

◆ m_Recompile

bool impl::CBaseCmd::m_Recompile
private

Definition at line 320 of file dbapi_impl_cmd.hpp.

Referenced by NeedToRecompile(), and SetRecompile().

◆ m_RowsSent

unsigned int impl::CBaseCmd::m_RowsSent
private

◆ m_RowsSentAtBatchStart

unsigned int impl::CBaseCmd::m_RowsSentAtBatchStart
private

Definition at line 330 of file dbapi_impl_cmd.hpp.

Referenced by GetRowsInCurrentBatch(), and CDB_BCPInCmd::SendRow().


The documentation for this class was generated from the following files:
Modified on Tue Apr 23 07:39:14 2024 by modify_doxy.py rev. 669887