⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interfaces.hpp

📁 ncbi源码
💻 HPP
📖 第 1 页 / 共 2 页
字号:
/* * =========================================================================== * PRODUCTION $Log: interfaces.hpp,v $ * PRODUCTION Revision 1000.0  2003/10/29 20:19:22  gouriano * PRODUCTION PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.16 * PRODUCTION * =========================================================================== */#ifndef DBAPI_DRIVER_CTLIB___INTERFACES__HPP#define DBAPI_DRIVER_CTLIB___INTERFACES__HPP/* $Id: interfaces.hpp,v 1000.0 2003/10/29 20:19:22 gouriano Exp $ * =========================================================================== * *                            PUBLIC DOMAIN NOTICE *               National Center for Biotechnology Information * *  This software/database is a "United States Government Work" under the *  terms of the United States Copyright Act.  It was written as part of *  the author's official duties as a United States Government employee and *  thus cannot be copyrighted.  This software/database is freely available *  to the public for use. The National Library of Medicine and the U.S. *  Government have not placed any restriction on its use or reproduction. * *  Although all reasonable efforts have been taken to ensure the accuracy *  and reliability of the software and data, the NLM and the U.S. *  Government do not and cannot warrant the performance or results that *  may be obtained by using this software or data. The NLM and the U.S. *  Government disclaim all warranties, express or implied, including *  warranties of performance, merchantability or fitness for any particular *  purpose. * *  Please cite the author in any work or product based on this material. * * =========================================================================== * * Author:  Vladimir Soussov * * File Description:  Driver for CTLib server * */#include <dbapi/driver/public.hpp>#include <dbapi/driver/util/parameters.hpp>#include <ctpublic.h>#include <bkpublic.h>BEGIN_NCBI_SCOPEclass CTLibContext;class CTL_Connection;class CTL_LangCmd;class CTL_RPCCmd;class CTL_CursorCmd;class CTL_BCPInCmd;class CTL_SendDataCmd;class CTL_RowResult;class CTL_ParamResult;class CTL_ComputeResult;class CTL_StatusResult;class CTL_CursorResult;/////////////////////////////////////////////////////////////////////////////////  CTLibContext:://class NCBI_DBAPIDRIVER_CTLIB_EXPORT CTLibContext : public I_DriverContext{    friend class CDB_Connection;public:    CTLibContext(bool reuse_context = true, CS_INT version = CS_VERSION_110);    //    // GENERIC functionality (see in <dbapi/driver/interfaces.hpp>)    //    virtual bool SetLoginTimeout (unsigned int nof_secs = 0);    virtual bool SetTimeout      (unsigned int nof_secs = 0);    virtual bool SetMaxTextImageSize(size_t nof_bytes);    virtual CDB_Connection* Connect(const string&   srv_name,                                    const string&   user_name,                                    const string&   passwd,                                    TConnectionMode mode,                                    bool            reusable  = false,                                    const string&   pool_name = kEmptyStr);    virtual ~CTLibContext();    //    // CTLIB specific functionality    //    // the following methods are optional (driver will use the default values    // if not called), the values will affect the new connections only    virtual void CTLIB_SetApplicationName(const string& a_name);    virtual void CTLIB_SetHostName(const string& host_name);    virtual void CTLIB_SetPacketSize(CS_INT packet_size);    virtual void CTLIB_SetLoginRetryCount(CS_INT n);    virtual void CTLIB_SetLoginLoopDelay(CS_INT nof_sec);    virtual bool IsAbleTo(ECapability cpb) const;    virtual CS_CONTEXT* CTLIB_GetContext() const;    static bool CTLIB_cserr_handler(CS_CONTEXT* context, CS_CLIENTMSG* msg);    static bool CTLIB_cterr_handler(CS_CONTEXT* context, CS_CONNECTION* con,                                    CS_CLIENTMSG* msg);    static bool CTLIB_srverr_handler(CS_CONTEXT* context, CS_CONNECTION* con,                                     CS_SERVERMSG* msg);private:    CS_CONTEXT* m_Context;    string      m_AppName;    string      m_HostName;    CS_INT      m_PacketSize;    CS_INT      m_LoginRetryCount;    CS_INT      m_LoginLoopDelay;    CS_CONNECTION* x_ConnectToServer(const string&   srv_name,                                     const string&   usr_name,                                     const string&   passwd,                                     TConnectionMode mode);};/////////////////////////////////////////////////////////////////////////////////  CTL_Connection:://class NCBI_DBAPIDRIVER_CTLIB_EXPORT CTL_Connection : public I_Connection{    friend class CTLibContext;    friend class CDB_Connection;    friend class CTL_LangCmd;    friend class CTL_RPCCmd;    friend class CTL_CursorCmd;    friend class CTL_BCPInCmd;    friend class CTL_SendDataCmd;protected:    CTL_Connection(CTLibContext* cntx, CS_CONNECTION* con,                   bool reusable, const string& pool_name);    virtual bool IsAlive();    virtual CDB_LangCmd*     LangCmd     (const string&   lang_query,                                          unsigned int    nof_params = 0);    virtual CDB_RPCCmd*      RPC         (const string&   rpc_name,                                          unsigned int    nof_args);    virtual CDB_BCPInCmd*    BCPIn       (const string&   table_name,                                          unsigned int    nof_columns);    virtual CDB_CursorCmd*   Cursor      (const string&   cursor_name,                                          const string&   query,                                          unsigned int    nof_params,                                          unsigned int    batch_size = 1);    virtual CDB_SendDataCmd* SendDataCmd (I_ITDescriptor& desc,                                          size_t          data_size,                                          bool            log_it = true);    virtual bool SendData(I_ITDescriptor& desc, CDB_Image& img,                          bool log_it = true);    virtual bool SendData(I_ITDescriptor& desc, CDB_Text&  txt,                          bool log_it = true);    virtual bool Refresh();    virtual const string& ServerName() const;    virtual const string& UserName()   const;    virtual const string& Password()   const;    virtual I_DriverContext::TConnectionMode ConnectMode() const;    virtual bool IsReusable() const;    virtual const string& PoolName() const;    virtual I_DriverContext* Context() const;    virtual void PushMsgHandler(CDB_UserHandler* h);    virtual void PopMsgHandler (CDB_UserHandler* h);    virtual CDB_ResultProcessor* SetResultProcessor(CDB_ResultProcessor* rp);    virtual void Release();    virtual ~CTL_Connection();    void DropCmd(CDB_BaseEnt& cmd);private:    bool x_SendData(I_ITDescriptor& desc, CDB_Stream& img, bool log_it = true);    I_ITDescriptor* x_GetNativeITDescriptor(const CDB_ITDescriptor& descr_in);    CS_CONNECTION*  m_Link;    CTLibContext*   m_Context;    CPointerPot     m_CMDs;    CDBHandlerStack m_MsgHandlers;    string          m_Server;    string          m_User;    string          m_Passwd;    string          m_Pool;    bool            m_Reusable;    bool            m_BCPable;    bool            m_SecureLogin;    CDB_ResultProcessor* m_ResProc;};/////////////////////////////////////////////////////////////////////////////////  CTL_LangCmd:://class NCBI_DBAPIDRIVER_CTLIB_EXPORT CTL_LangCmd : public I_LangCmd{    friend class CTL_Connection;protected:    CTL_LangCmd(CTL_Connection* conn, CS_COMMAND* cmd,                const string& lang_query, unsigned int nof_params);    virtual bool More(const string& query_text);    virtual bool BindParam(const string& param_name, CDB_Object* param_ptr);    virtual bool SetParam(const string& param_name, CDB_Object* param_ptr);    virtual bool Send();    virtual bool WasSent() const;    virtual bool Cancel();    virtual bool WasCanceled() const;    virtual CDB_Result* Result();    virtual bool HasMoreResults() const;    virtual bool HasFailed() const;    virtual int  RowCount() const;    virtual void DumpResults();    virtual void Release();    virtual ~CTL_LangCmd();private:    bool x_AssignParams();    CTL_Connection* m_Connect;    CS_COMMAND*     m_Cmd;    string          m_Query;    CDB_Params      m_Params;    bool            m_WasSent;    bool            m_HasFailed;    I_Result*       m_Res;    int             m_RowCount;};/////////////////////////////////////////////////////////////////////////////////  CTL_RPCCmd:://class NCBI_DBAPIDRIVER_CTLIB_EXPORT CTL_RPCCmd : public I_RPCCmd{    friend class CTL_Connection;protected:    CTL_RPCCmd(CTL_Connection* con, CS_COMMAND* cmd,               const string& proc_name, unsigned int nof_params);    virtual bool BindParam(const string& param_name, CDB_Object* param_ptr,                           bool out_param = false);    virtual bool SetParam(const string& param_name, CDB_Object* param_ptr,                          bool out_param = false);    virtual bool Send();    virtual bool WasSent() const;    virtual bool Cancel();    virtual bool WasCanceled() const;    virtual CDB_Result* Result();    virtual bool HasMoreResults() const;    virtual bool HasFailed() const;    virtual int  RowCount() const;    virtual void DumpResults();    virtual void SetRecompile(bool recompile = true);    virtual void Release();    virtual ~CTL_RPCCmd();private:    bool x_AssignParams();    CTL_Connection* m_Connect;    CS_COMMAND*     m_Cmd;    string          m_Query;    CDB_Params      m_Params;    bool            m_WasSent;    bool            m_HasFailed;    bool            m_Recompile;    I_Result*       m_Res;    int             m_RowCount;};/////////////////////////////////////////////////////////////////////////////////  CTL_CursorCmd:://class NCBI_DBAPIDRIVER_CTLIB_EXPORT CTL_CursorCmd : public I_CursorCmd{    friend class CTL_Connection;protected:    CTL_CursorCmd(CTL_Connection* conn, CS_COMMAND* cmd,                  const string& cursor_name, const string& query,                  unsigned int nof_params, unsigned int fetch_size);    virtual bool BindParam(const string& param_name, CDB_Object* param_ptr);    virtual CDB_Result* Open();    virtual bool Update(const string& table_name, const string& upd_query);    virtual bool UpdateTextImage(unsigned int item_num, CDB_Stream& data, 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -