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

📄 interfaces.hpp

📁 ncbi源码
💻 HPP
📖 第 1 页 / 共 2 页
字号:
protected:  CGW_Connection* con;  CGW_RPCCmd(CGW_Connection* con_arg, int remoteObj_arg)  {    con       = con_arg;    remoteObj = remoteObj_arg;  }  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()  {    // ?? 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 SetRecompile(bool recompile = true)  {    int i = (int)recompile;    comprot_void1("GWLib:RPCCmd:SetRecompile", remoteObj, &i );  }  virtual void DumpResults()  {    comprot_void("GWLib:RPCCmd:DumpResults",remoteObj);  }};class CGW_BCPInCmd : public I_BCPInCmd, CGW_Base{  friend class CGW_Connection;protected:  CGW_Connection* con;  CRLObjPairs* boundObjects;  CGW_BCPInCmd(CGW_Connection* con_arg, int remoteObj_arg)  {    con       = con_arg;    remoteObj = remoteObj_arg;    boundObjects=NULL;  }  // Binding  virtual bool Bind(unsigned int column_num, CDB_Object* param_ptr);  // Send row to the server  virtual bool SendRow();  // Complete batch -- to store all rows transferred so far in this batch  // into the table  virtual bool CompleteBatch()  {    return comprot_bool( "GWLib:BCPInCmd:CompleteBatch", remoteObj );  }  // Cancel the BCP command  virtual bool Cancel();  // Complete the BCP and store all rows transferred in last batch  // into the table  virtual bool CompleteBCP();  ~CGW_BCPInCmd();};class CGW_CursorCmd : public I_CursorCmd, CGW_Base{  friend class CGW_Connection;protected:  CGW_Connection* con;  CRLObjPairs* boundObjects;  CGW_CursorCmd(CGW_Connection* con_arg, int remoteObj_arg)  {    con       = con_arg;    remoteObj = remoteObj_arg;    boundObjects = NULL;  }  // Not implemented  virtual bool BindParam(const string& name, CDB_Object* param_ptr);  // Open the cursor.  // Return NULL if cursor resulted in no data.  // Throw exception on error.  virtual CDB_Result* Open();  // Update the last fetched row.  // NOTE: the cursor must be declared for update in CDB_Connection::Cursor()  virtual bool Update(const string& table_name, const string& upd_query)  {    return comprot_int2(      "GWLib:CursorCmd:Update", remoteObj,      "table_name", table_name.c_str(),      "upd_query", upd_query.c_str() );  }  virtual bool UpdateTextImage(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);  // Delete the last fetched row.  // NOTE: the cursor must be declared for delete in CDB_Connection::Cursor()  virtual bool Delete(const string& table_name)  {    return comprot_bool1("GWLib:CursorCmd:Delete", remoteObj, table_name.c_str() );  }  // Get the number of fetched rows  // 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:CursorCmd:RowCount", remoteObj);  }  // Close the cursor.  // Return FALSE if the cursor is closed already (or not opened yet)  virtual bool Close();  ~CGW_CursorCmd();};class CGW_SendDataCmd : public I_SendDataCmd, CGW_Base{  friend class CGW_Connection;  friend class CGW_CursorCmd;protected:  CGW_Connection* con;  CGW_SendDataCmd(CGW_Connection* con_arg, int remoteObj_arg)  {    con       = con_arg;    remoteObj = remoteObj_arg;  }  // Send chunk of data to the server.  // Return number of bytes actually transferred to server.  virtual size_t SendChunk(const void* pChunk, size_t nofBytes);};class CGW_ITDescriptor : public I_ITDescriptor{private:  int remoteObj;public:  CGW_ITDescriptor(int remoteObj_arg)  {    remoteObj = remoteObj_arg;  }  int getRemoteObj()  {    return remoteObj;  }  int DescriptorType() const  {    return comprot_int("GWLib:ITDescriptor:DescriptorType", remoteObj);  }};class CGW_Result : public I_Result, CGW_Base{protected:  typedef map<unsigned,string> MapUnsignedToString;  MapUnsignedToString mapItemNames;public:  CGW_Result(int remoteObj_arg)  {    remoteObj = remoteObj_arg;  }  // ~CGW_Result() { mapItemNames.clear(); }  virtual EDB_ResType ResultType() const  {    return (EDB_ResType)comprot_int("GWLib:Result:ResultType",remoteObj);  }  // Get # of columns in the result  virtual unsigned int NofItems() const  {    return comprot_int("GWLib:Result:NofItems",remoteObj);  }  // Get name of a result item; returnr NULL if "item_num" >= NofItems().  virtual const char* ItemName(unsigned int item_num) const;  // Get size (in bytes) of a result item.  // Return zero if "item_num" >= NofItems().  virtual size_t ItemMaxSize(unsigned int item_num) const  {    return comprot_int1("GWLib:Result:ItemMaxSize",remoteObj,(int*)&item_num);  }  // Get datatype of a result item.  // Return 'eDB_UnsupportedType' if "item_num" >= NofItems().  virtual EDB_Type ItemDataType(unsigned int item_num) const  {    return (EDB_Type) comprot_int1("GWLib:Result:ItemDataType",remoteObj,(int*)&item_num);  }  // Fetch next row.  // Return FALSE if no more rows to fetch. Throw exception on any error.  virtual bool Fetch()  {    return comprot_bool( "GWLib:Result:Fetch", remoteObj );  }  // Return current item number we can retrieve (0,1,...)  // Return "-1" if no more items left (or available) to read.  virtual int CurrentItemNo() const  {    return comprot_int( "GWLib:Result:CurrentItemNo", remoteObj );  }  // Get a result item (you can use either GetItem or ReadItem).  // If "item_buf" is not NULL, then use "*item_buf" (its type should be  // compatible with the type of retrieved item!) to retrieve the item to;  // otherwise allocate new "CDB_Object".  virtual CDB_Object* GetItem(CDB_Object* item_buf = 0);  // Read a result item body (for text/image mostly).  // Return number of successfully read bytes.  // Set "*is_null" to TRUE if the item is <NULL>.  // Throw an exception on any error.  virtual size_t ReadItem(void* buffer, size_t buffer_size,                          bool* is_null = 0);  // Get a descriptor for text/image column (for SendData).  // Return NULL if this result does not (or cannot) have img/text descriptor.  // NOTE: you need to call ReadItem (maybe even with buffer_size == 0)  //       before calling this method!  virtual I_ITDescriptor* GetImageOrTextDescriptor()  {    int res = comprot_int( "GWLib:Result:GetImageOrTextDescriptor", remoteObj );    if(res) {      return new CGW_ITDescriptor(res);    }    else{      return NULL;    }  }  // Skip result item  virtual bool SkipItem()  {    return comprot_bool( "GWLib:Result:SkipItem", remoteObj );  }};END_NCBI_SCOPE#endif  /* DBAPI_DRIVER_GATEWAY___INTERFACES__HPP *//* * =========================================================================== * $Log: interfaces.hpp,v $ * Revision 1000.1  2004/04/21 14:47:22  gouriano * PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.7 * * Revision 1.7  2003/07/16 17:33:11  sapojnik * SetResultProcessor(), DumpResults() - almost empty implementations * * Revision 1.6  2003/05/19 21:51:51  sapojnik * Client portion of gateway driver back in C++ tree - now assembles as dll, and runs on Sparc Solaris * * Revision 1.9  2003/05/12 20:53:31  sapojnik * class C_GWLib_MsgCallback,  CGW_Connection::Push/PopMsgHandler() * * Revision 1.8  2003/05/05 21:53:33  sapojnik * CGWBase::xSend() returns int * * Revision 1.7  2003/05/05 14:36:06  sapojnik * CGW_Base::xBind(),xSend() and boundObjects member in classes with Send/Bind() * * Revision 1.6  2003/02/21 20:12:22  sapojnik * many changes, mostly implementing and debugging BCP Bind/SendRow() * * Revision 1.5  2003/01/08 22:52:27  sapojnik * *** empty log message *** * * Revision 1.4  2003/01/08 22:11:07  sapojnik * RPCCmd:SetRecompile - do send flag vlue * * Revision 1.3  2002/12/03 16:43:25  sapojnik * *** empty log message *** * * Revision 1.2  2002/11/27 21:11:22  sapojnik * Bind/SetParam(), SendData(), sending CDB_Float/DoubleO. etc. * implemented for various classes, not tested yet; * it seems that only CGW_Connection::Push/PopMsgHandler() still remain. * * =========================================================================== */

⌨️ 快捷键说明

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