NCBI C++ ToolKit
Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
CMySQL_Connection Class Reference

Search Toolkit Book for CMySQL_Connection

#include <dbapi/driver/mysql/interfaces.hpp>

+ Inheritance diagram for CMySQL_Connection:
+ Collaboration diagram for CMySQL_Connection:

Protected Member Functions

 CMySQL_Connection (CMySQLContext &cntx, const CDBConnParams &params)
 
virtual ~CMySQL_Connection ()
 
virtual bool IsAlive ()
 Check out if connection is alive (this function doesn't ping the server, it just checks the status of connection which was set by the last i/o operation) More...
 
virtual CDB_LangCmdLangCmd (const string &lang_query)
 These methods: LangCmd(), RPC(), BCPIn(), Cursor() and SendDataCmd() create and return a "command" object, register it for later use with this (and only this!) connection. More...
 
virtual CDB_SendDataCmdSendDataCmd (I_BlobDescriptor &desc, size_t data_size, bool log_it=true, bool dump_results=true)
 "Send-data" command More...
 
virtual CDB_RPCCmdRPC (const string &rpc_name)
 Remote procedure call. More...
 
virtual CDB_BCPInCmdBCPIn (const string &table_name)
 "Bulk copy in" command More...
 
virtual CDB_CursorCmdCursor (const string &cursor_name, const string &query, unsigned int batch_size=1)
 Cursor. More...
 
virtual bool SendData (I_BlobDescriptor &desc, CDB_Stream &lob, bool log_it=true)
 Shortcut to send text and image to the server without using the "Send-data" command (SendDataCmd) More...
 
virtual bool Refresh ()
 Reset the connection to the "ready" state (cancel all active commands) More...
 
virtual I_DriverContext::TConnectionMode ConnectMode () const
 Get the bitmask for the connection mode (BCP, secure login, ...) More...
 
virtual bool Abort ()
 abort the connection Attention: it is not recommended to use this method unless you absolutely have to. More...
 
virtual bool Close (void)
 Close an open connection. More...
 
virtual void SetTimeout (size_t nof_secs)
 
virtual void SetCancelTimeout (size_t nof_secs)
 
const TDbgInfoGetDbgInfo (void) const
 
- Protected Member Functions inherited from impl::CConnection
CDB_LangCmdCreate_LangCmd (CBaseCmd &lang_cmd)
 These methods to allow the children of CConnection to create various command-objects. More...
 
CDB_RPCCmdCreate_RPCCmd (CBaseCmd &rpc_cmd)
 
CDB_BCPInCmdCreate_BCPInCmd (CBaseCmd &bcpin_cmd)
 
CDB_CursorCmdCreate_CursorCmd (CBaseCmd &cursor_cmd)
 
CDB_SendDataCmdCreate_SendDataCmd (CSendDataCmd &senddata_cmd)
 
void Release (void)
 
const CDBHandlerStackGetMsgHandlers (void) const
 
CDBHandlerStackGetMsgHandlers (void)
 
void DropCmd (impl::CCommand &cmd)
 
void DeleteAllCommands (void)
 
void AttachTo (CDB_Connection *interface)
 
void ReleaseInterface (void)
 
void DetachResultProcessor (void)
 
void CheckCanOpen (void)
 
void MarkClosed (void)
 
unsigned int GetReuseCount (void) const
 
bool IsBCPable (void) const
 
bool HasSecureLogin (void) const
 
TDbgInfoSetDbgInfo (void)
 
void SetServerType (CDBConnParams::EServerType type)
 
const CDBHandlerStackGetOpeningMsgHandlers (void) const
 
CObjectx_GetUserData (void) const
 
void x_RecordServer (const CDBServer &server)
 
void x_DisableReuse (void)
 

Private Member Functions

const CDBParamsGetLastParams (void) const
 

Private Attributes

MYSQL m_MySQL
 
CMySQL_LangCmdm_ActiveCmd
 
bool m_IsOpen
 

Friends

class CMySQLContext
 
class CMySQL_LangCmd
 
class CMySQL_RowResult
 

Additional Inherited Members

- Public Types inherited from impl::CConnection
typedef CDB_Exception::SContext TDbgInfo
 
- Public Types inherited from I_ConnectionExtra
typedef SOCKET TSockHandle
 
- Public Member Functions inherited from impl::CConnection
 CConnection (CDriverContext &dc, const CDBConnParams &params, bool isBCPable=false)
 
virtual ~CConnection (void)
 
CDB_ResultProcessorGetResultProcessor (void) const
 
CDriverContextGetCDriverContext (void)
 
const CDriverContextGetCDriverContext (void) const
 
bool IsMultibyteClientEncoding (void) const
 
EEncoding GetClientEncoding (void) const
 
void SetExtraMsg (const string &msg)
 
const stringGetExtraMsg (void) const
 
const stringGetServerName (void) const
 
const stringGetUserName (void) const
 
const stringGetPassword (void) const
 
const stringGetDatabaseName (void) const
 
const stringGetRequestedServer (void) const
 
bool IsOpeningFinished (void) const
 
void FinishOpening (void)
 
bool IsValid (void) const
 
virtual void SetDatabaseName (const string &name)
 
void Invalidate (void)
 
const stringServerName (void) const
 Get the server name, user login name, and password. More...
 
Uint4 Host (void) const
 
Uint2 Port (void) const
 
const stringUserName (void) const
 
const stringPassword (void) const
 
bool IsReusable (void) const
 Check if this connection is a reusable one. More...
 
const stringPoolName (void) const
 Find out which connection pool this connection belongs to. More...
 
I_DriverContextContext (void) const
 Get pointer to the driver context. More...
 
void PushMsgHandler (CDB_UserHandler *h, EOwnership ownership=eNoOwnership)
 Put the message handler into message handler stack. More...
 
void PopMsgHandler (CDB_UserHandler *h)
 Remove the message handler (and all above it) from the stack. More...
 
CDB_ResultProcessorSetResultProcessor (CDB_ResultProcessor *rp)
 
virtual void SetBlobSize (size_t nof_bytes)
 
void SetTextImageSize (size_t nof_bytes)
 
virtual size_t GetTimeout (void) const
 
virtual size_t GetCancelTimeout (void) const
 
virtual TSockHandle GetLowLevelHandle (void) const
 Get OS handle of the socket represented by the connection. More...
 
virtual string GetDriverName (void) const
 
virtual unsigned int GetRowsInCurrentBatch (void) const
 
CDBConnParams::EServerType GetServerType (void)
 
CDB_BigDateTime::ESyntax GetDateTimeSyntax (void)
 
CDBConnParams::EServerType CalculateServerType (CDBConnParams::EServerType server_type)
 
void SetUserData (CObject *data)
 
- Public Member Functions inherited from I_ConnectionExtra
virtual ~I_ConnectionExtra (void)
 
template<typename T >
TGetUserData (void)
 
template<typename T >
const TGetUserData (void) const
 
- Static Protected Member Functions inherited from impl::CConnection
static CDB_ResultCreate_Result (impl::CResult &result)
 

Detailed Description

Definition at line 89 of file interfaces.hpp.

Constructor & Destructor Documentation

◆ CMySQL_Connection()

CMySQL_Connection::CMySQL_Connection ( CMySQLContext cntx,
const CDBConnParams params 
)
protected

◆ ~CMySQL_Connection()

CMySQL_Connection::~CMySQL_Connection ( )
protectedvirtual

Member Function Documentation

◆ Abort()

bool CMySQL_Connection::Abort ( )
protectedvirtual

abort the connection Attention: it is not recommended to use this method unless you absolutely have to.

The expected implementation is - close underlying file descriptor[s] without destroing any objects associated with a connection. Returns: true - if succeed false - if not

Implements impl::CConnection.

Definition at line 165 of file connection.cpp.

◆ BCPIn()

CDB_BCPInCmd * CMySQL_Connection::BCPIn ( const string table_name)
protectedvirtual

"Bulk copy in" command

Implements impl::CConnection.

Definition at line 152 of file connection.cpp.

References NULL.

◆ Close()

bool CMySQL_Connection::Close ( void  )
protectedvirtual

Close an open connection.

Returns: true - if successfully closed an open connection. false - if not

Implements impl::CConnection.

Definition at line 170 of file connection.cpp.

References m_IsOpen, m_MySQL, impl::CConnection::MarkClosed(), and Refresh().

Referenced by ~CMySQL_Connection().

◆ ConnectMode()

I_DriverContext::TConnectionMode CMySQL_Connection::ConnectMode ( ) const
protectedvirtual

Get the bitmask for the connection mode (BCP, secure login, ...)

Implements impl::CConnection.

Definition at line 133 of file connection.cpp.

◆ Cursor()

CDB_CursorCmd * CMySQL_Connection::Cursor ( const string cursor_name,
const string query,
unsigned int  batch_size = 1 
)
protectedvirtual

Cursor.

Implements impl::CConnection.

Definition at line 158 of file connection.cpp.

References NULL.

◆ GetDbgInfo()

const CMySQL_Connection::TDbgInfo & CMySQL_Connection::GetDbgInfo ( void  ) const
inlineprotectedvirtual

Reimplemented from impl::CConnection.

Definition at line 278 of file interfaces.hpp.

References GetDbgInfo, CMySQL_LangCmd::GetDbgInfo(), and m_ActiveCmd.

Referenced by CMySQL_RowResult::GetDbgInfo().

◆ GetLastParams()

const CDBParams * CMySQL_Connection::GetLastParams ( void  ) const
inlineprivate

Definition at line 283 of file interfaces.hpp.

References impl::CBaseCmd::GetLastParams(), m_ActiveCmd, and NULL.

Referenced by CMySQL_RowResult::GetLastParams().

◆ IsAlive()

bool CMySQL_Connection::IsAlive ( )
protectedvirtual

Check out if connection is alive (this function doesn't ping the server, it just checks the status of connection which was set by the last i/o operation)

Implements impl::CConnection.

Definition at line 86 of file connection.cpp.

◆ LangCmd()

CDB_LangCmd * CMySQL_Connection::LangCmd ( const string lang_query)
protectedvirtual

These methods: LangCmd(), RPC(), BCPIn(), Cursor() and SendDataCmd() create and return a "command" object, register it for later use with this (and only this!) connection.

On error, an exception will be thrown (they never return NULL!). It is the user's responsibility to delete the returned "command" object. Language command

Implements impl::CConnection.

Definition at line 139 of file connection.cpp.

References CMySQL_LangCmd, and impl::CConnection::Create_LangCmd().

◆ Refresh()

bool CMySQL_Connection::Refresh ( )
protectedvirtual

Reset the connection to the "ready" state (cancel all active commands)

Implements impl::CConnection.

Definition at line 124 of file connection.cpp.

References impl::CConnection::DeleteAllCommands().

Referenced by Close().

◆ RPC()

CDB_RPCCmd * CMySQL_Connection::RPC ( const string rpc_name)
protectedvirtual

Remote procedure call.

Implements impl::CConnection.

Definition at line 146 of file connection.cpp.

References NULL.

◆ SendData()

bool CMySQL_Connection::SendData ( I_BlobDescriptor desc,
CDB_Stream lob,
bool  log_it = true 
)
protectedvirtual

Shortcut to send text and image to the server without using the "Send-data" command (SendDataCmd)

Implements impl::CConnection.

Definition at line 117 of file connection.cpp.

◆ SendDataCmd()

CDB_SendDataCmd * CMySQL_Connection::SendDataCmd ( I_BlobDescriptor desc,
size_t  data_size,
bool  log_it = true,
bool  dump_results = true 
)
protectedvirtual

"Send-data" command

Implements impl::CConnection.

Definition at line 108 of file connection.cpp.

◆ SetCancelTimeout()

void CMySQL_Connection::SetCancelTimeout ( size_t  nof_secs)
protectedvirtual

Implements impl::CConnection.

Definition at line 101 of file connection.cpp.

References _TRACE.

◆ SetTimeout()

void CMySQL_Connection::SetTimeout ( size_t  nof_secs)
protectedvirtual

Implements impl::CConnection.

Definition at line 93 of file connection.cpp.

References _TRACE.

Friends And Related Function Documentation

◆ CMySQL_LangCmd

friend class CMySQL_LangCmd
friend

Definition at line 137 of file interfaces.hpp.

Referenced by LangCmd().

◆ CMySQL_RowResult

friend class CMySQL_RowResult
friend

Definition at line 138 of file interfaces.hpp.

◆ CMySQLContext

friend class CMySQLContext
friend

Definition at line 91 of file interfaces.hpp.

Member Data Documentation

◆ m_ActiveCmd

CMySQL_LangCmd* CMySQL_Connection::m_ActiveCmd
private

◆ m_IsOpen

bool CMySQL_Connection::m_IsOpen
private

Definition at line 145 of file interfaces.hpp.

Referenced by Close(), and CMySQL_Connection().

◆ m_MySQL

MYSQL CMySQL_Connection::m_MySQL
private

The documentation for this class was generated from the following files:
Modified on Mon May 20 05:03:38 2024 by modify_doxy.py rev. 669887