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

📄 interfaces.hpp

📁 ncbi源码
💻 HPP
📖 第 1 页 / 共 2 页
字号:
/* * =========================================================================== * PRODUCTION $Log: interfaces.hpp,v $ * PRODUCTION Revision 1000.1  2004/04/21 14:47:22  gouriano * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.7 * PRODUCTION * =========================================================================== */#ifndef DBAPI_DRIVER_GATEWAY___INTERFACES__HPP#define DBAPI_DRIVER_GATEWAY___INTERFACES__HPP/* $Id: interfaces.hpp,v 1000.1 2004/04/21 14:47: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:  Victor Sapojnikov * * File Description: *   A gateway to a remote database driver that is running on the sss server. * */#include <dbapi/driver/interfaces.hpp>#include <dbapi/driver/public.hpp>#include <dbapi/driver/util/handle_stack.hpp>#include <dbapi/driver/gateway/comprot_cli.hpp>#include <srv/igate.hpp>#include <map>BEGIN_NCBI_SCOPE// DllExport ...class CRLObjPairs;void DBAPI_RegisterDriver_GW(I_DriverMgr& mgr);class CGWContext;class CGW_Connection;class CGW_RPCCmd;class CGW_CursorCmd;class C_GWLib_MsgCallback;class CGW_Base{  friend class CGW_Connection;protected:  int remoteObj;  virtual void Release()  {    comprot_void("GWLib:Base:Release",remoteObj);  }  ~CGW_Base()  {    comprot_void("GWLib:Base:delete",remoteObj);  }  int xSend(const char* rpc_name, CRLObjPairs* boundObjects);  bool xBind(IGate* pGate, CDB_Object* localObj, CRLObjPairs** boundObjects);  CRLObjPairs* getBoundObjects(CRLObjPairs** ppVector); // Allocate vector on first request};class CGWContext : public I_DriverContext{  int remoteObj;public:  CGWContext(CSSSConnection& sssConnection);  virtual bool IsAbleTo(ECapability cpb) const  {    return comprot_bool1( "GWLib:Context:IsAbleTo", remoteObj, (int*)&cpb );  }  virtual bool SetLoginTimeout (unsigned int nof_secs = 0)  {    return comprot_bool1( "GWLib:Context:SetLoginTimeout", remoteObj, &nof_secs );  }  virtual bool SetTimeout(unsigned int nof_secs = 0)  {    return comprot_bool1( "GWLib:Context:SetTimeout", remoteObj, &nof_secs );  }  virtual bool SetMaxTextImageSize(size_t nof_bytes)  {    return comprot_bool1( "GWLib:Context:SetMaxTextImageSize", remoteObj, (int*)&nof_bytes );  }  virtual unsigned int NofConnections(const string& srv_name = kEmptyStr) const  {    return (unsigned int)(comprot_int1( "GWLib:Context:NofConnections", remoteObj, srv_name.c_str() ));  }  virtual ~CGWContext()  {    // cerr << "~CGWContext()\n";    comprot_void( "GWLib:Context:delete", remoteObj );  }  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);};struct SConnectionVars{  // These variables are not stored directly in CGW_Connection  // in order to make it possible to change them in const methods:  // ServerName(), UserName(), etc.  string m_Server, m_User, m_Password, m_PoolName;};class CGW_Connection : public I_Connection, CGW_Base{  friend class CGWContext;  friend class CGW_CursorCmd;  friend class C_GWLib_MsgCallback;protected:  CGWContext* localContext;  SConnectionVars* vars;  CGW_Connection(CGWContext* localContext_arg, int remoteObj_arg)  {    localContext = localContext_arg;    remoteObj    = remoteObj_arg;    vars = new SConnectionVars;  }  // virtual  ~CGW_Connection()  {    delete vars;    // Free server-side MsgHandler    comprot_void("GWLib:Connection:delete",remoteObj);  }  virtual bool IsAlive()  {    return comprot_bool( "GWLib:Connection:IsAlive", remoteObj );  }  virtual CDB_RPCCmd* RPC( const string& rpc_name, unsigned int nof_args);  virtual CDB_LangCmd* LangCmd(const string&  lang_query, unsigned int nof_params = 0);  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 Refresh()  {    return comprot_bool("GWLib:Connection:Refresh", remoteObj);  }  virtual const string& ServerName() const;  virtual const string& UserName()   const;  virtual const string& Password()   const;  virtual const string& PoolName()   const;  virtual I_DriverContext::TConnectionMode ConnectMode() const  {    return (I_DriverContext::TConnectionMode)      comprot_int("GWLib:Connection:ConnectMode", remoteObj);  }  virtual bool IsReusable() const  {    return comprot_bool("GWLib:Connection:IsReusable", remoteObj);  }  virtual I_DriverContext* Context() const  {    return localContext;  }  // void DropCmd(CDB_BaseEnt& cmd);  virtual bool xSendData(I_ITDescriptor& desc, CDB_Stream* img, 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 CDB_ResultProcessor* SetResultProcessor(CDB_ResultProcessor* rp) { return NULL; }  virtual void PushMsgHandler(CDB_UserHandler* /*h*/);  virtual void PopMsgHandler (CDB_UserHandler* /*h*/);  // virtual void Release() {}  CDBHandlerStack m_MsgHandlers;};class CGW_BaseCmd : public I_BaseCmd, public CGW_Base{protected:  CRLObjPairs* boundObjects;public:  CGW_BaseCmd()  {    boundObjects=NULL;  }  virtual bool Send();  virtual bool WasSent() const  {    return comprot_bool("GWLib:BaseCmd:WasSent", remoteObj);  }  // Cancel the command execution  virtual bool Cancel();  virtual bool WasCanceled() const  {    return comprot_bool("GWLib:BaseCmd:WasCanceled", remoteObj);  }  // Get result set  virtual CDB_Result* Result();  virtual bool HasMoreResults() const  {    return comprot_bool( "GWLib:BaseCmd:HasMoreResults", remoteObj );  }  // Check if command has failed  virtual bool HasFailed() const  {    return comprot_bool("GWLib:BaseCmd:HasFailed", remoteObj );  }  // 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).  virtual int RowCount() const  {    return comprot_int("GWLib:BaseCmd:RowCount", remoteObj );  }  // Destructor  virtual ~CGW_BaseCmd();};class CGW_LangCmd : public I_LangCmd, CGW_BaseCmd{  friend class CGW_Connection;protected:  CGW_Connection* con;  CGW_LangCmd(CGW_Connection* con_arg, int remoteObj_arg)  {    con       = con_arg;    remoteObj = remoteObj_arg;  }  virtual bool More(const string& query_text)  {    return comprot_bool1("GWLib:LangCmd:More", remoteObj, query_text.c_str() );  }  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()  {    // ?? send bound params ??    return CGW_BaseCmd::Send();  }  virtual bool WasSent() const  {    return CGW_BaseCmd::WasSent();  }  virtual bool Cancel();  /*  {    return CGW_BaseCmd::Cancel();  }  */  virtual bool WasCanceled() const  {    return CGW_BaseCmd::WasCanceled();  }  virtual CDB_Result* Result()  {    return CGW_BaseCmd::Result();  }  virtual bool HasMoreResults() const  {    return CGW_BaseCmd::HasMoreResults();  }  virtual bool HasFailed() const  {    return CGW_BaseCmd::HasFailed();  }  virtual int  RowCount() const  {    return CGW_BaseCmd::RowCount();  }  virtual void DumpResults()  {    comprot_void("GWLib:LangCmd:DumpResults",remoteObj);  }};class CGW_RPCCmd : public I_RPCCmd, CGW_BaseCmd{  friend class CGW_Connection;

⌨️ 快捷键说明

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