📄 public.hpp
字号:
// Setting virtual bool SetParam(const string& name, CDB_Object* value, bool out_param = false); // Send command to the server virtual bool Send(); virtual bool WasSent() const; // Cancel the command execution virtual bool Cancel(); virtual bool WasCanceled() const; // Get result set. // Return NULL if no more results left to read. // Throw exception on error or if attempted to read after NULL was returned virtual CDB_Result* Result(); // Return TRUE if it makes sense (at all) to call Result() virtual bool HasMoreResults() const; // Check if command has failed virtual bool HasFailed() const; // 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; // Dump the results of the command // If result processor is installed for this connection, then it will be // called for each result set virtual void DumpResults(); // Set the "recompile before execute" flag for the stored proc virtual void SetRecompile(bool recompile = true); // Destructor virtual ~CDB_RPCCmd(); private: I_RPCCmd* m_Cmd; // The constructor should be called by "I_Connection" only! friend class I_Connection; CDB_RPCCmd(I_RPCCmd* rpc); // Prohibit default- and copy- constructors, and assignment CDB_RPCCmd& operator= (const CDB_RPCCmd&); CDB_RPCCmd(const CDB_RPCCmd&); CDB_RPCCmd();};class NCBI_DBAPIDRIVER_EXPORT CDB_BCPInCmd : public I_BCPInCmd{public: // Binding virtual bool Bind(unsigned int column_num, CDB_Object* value); // Send row to the server virtual bool SendRow(); // Complete batch -- to store all rows transferred by far in this batch // into the table virtual bool CompleteBatch(); // Cancel the BCP command virtual bool Cancel(); // Complete the BCP and store all rows transferred in last batch into // the table virtual bool CompleteBCP(); // Destructor virtual ~CDB_BCPInCmd();private: I_BCPInCmd* m_Cmd; // The constructor should be called by "I_Connection" only! friend class I_Connection; CDB_BCPInCmd(I_BCPInCmd* bcp); // Prohibit default- and copy- constructors, and assignment CDB_BCPInCmd& operator= (const CDB_BCPInCmd&); CDB_BCPInCmd(const CDB_BCPInCmd&); CDB_BCPInCmd();};class NCBI_DBAPIDRIVER_EXPORT CDB_CursorCmd : public I_CursorCmd{public: // Binding virtual bool BindParam(const string& name, CDB_Object* value); // 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); 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); // 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; // Close the cursor. // Return FALSE if the cursor is closed already (or not opened yet) virtual bool Close(); // Destructor virtual ~CDB_CursorCmd();private: I_CursorCmd* m_Cmd; // The constructor should be called by "I_Connection" only! friend class I_Connection; CDB_CursorCmd(I_CursorCmd* cur); // Prohibit default- and copy- constructors, and assignment CDB_CursorCmd& operator= (const CDB_CursorCmd&); CDB_CursorCmd(const CDB_CursorCmd&); CDB_CursorCmd();};class NCBI_DBAPIDRIVER_EXPORT CDB_SendDataCmd : public I_SendDataCmd{public: // Send chunk of data to the server. // Return number of bytes actually transferred to server. virtual size_t SendChunk(const void* data, size_t size); // Destructor virtual ~CDB_SendDataCmd();private: I_SendDataCmd* m_Cmd; // The constructor should be called by "I_Connection" only! friend class I_Connection; CDB_SendDataCmd(I_SendDataCmd* c); // Prohibit default- and copy- constructors, and assignment CDB_SendDataCmd& operator= (const CDB_SendDataCmd&); CDB_SendDataCmd(const CDB_CursorCmd&); CDB_SendDataCmd();};class NCBI_DBAPIDRIVER_EXPORT CDB_ITDescriptor : public I_ITDescriptor{public: CDB_ITDescriptor(const string& table_name, const string& column_name, const string& search_conditions) : m_TableName(table_name), m_ColumnName(column_name), m_SearchConditions(search_conditions) {} virtual int DescriptorType() const; const string& TableName() const { return m_TableName; } const string& ColumnName() const { return m_ColumnName; } const string& SearchConditions() const { return m_SearchConditions; } virtual ~CDB_ITDescriptor();protected: string m_TableName; string m_ColumnName; string m_SearchConditions;};class NCBI_DBAPIDRIVER_EXPORT CDB_ResultProcessor{public: CDB_ResultProcessor(CDB_Connection* c); virtual ~CDB_ResultProcessor(); // The default implementation just dumps all rows. // To get the data you will need to override this method. virtual void ProcessResult(CDB_Result& res);private: // Prohibit default- and copy- constructors, and assignment CDB_ResultProcessor(); CDB_ResultProcessor& operator= (const CDB_ResultProcessor&); CDB_ResultProcessor(const CDB_ResultProcessor&); CDB_ResultProcessor* m_Prev; CDB_Connection* m_Con;};END_NCBI_SCOPE/* @} *//* * =========================================================================== * $Log: public.hpp,v $ * Revision 1000.0 2003/10/29 20:19:08 gouriano * PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.9 * * Revision 1.9 2003/06/20 19:11:23 vakatov * CDB_ResultProcessor:: * - added MS-Win DLL export macro * - made the destructor virtual * - moved code from the header to the source file * - formally reformatted the code * * Revision 1.8 2003/06/05 15:54:43 soussov * adds DumpResults method for LangCmd and RPC, SetResultProcessor method * for Connection interface, adds CDB_ResultProcessor class * * Revision 1.7 2003/04/11 17:46:09 siyan * Added doxygen support * * Revision 1.6 2002/12/26 19:29:12 dicuccio * Added Win32 export specifier for base DBAPI library * * Revision 1.5 2002/03/26 15:25:17 soussov * new image/text operations added * * Revision 1.4 2002/02/13 22:11:16 sapojnik * several methods changed from private to protected to allow derived * classes (needed for rdblib) * * Revision 1.3 2001/11/06 17:58:03 lavr * Formatted uniformly as the rest of the library * * Revision 1.2 2001/09/27 20:08:29 vakatov * Added "DB_" (or "I_") prefix where it was missing * * Revision 1.1 2001/09/21 23:39:52 vakatov * ----- Initial (draft) revision. ----- * This is a major revamp (by Denis Vakatov, with help from Vladimir Soussov) * of the DBAPI "driver" libs originally written by Vladimir Soussov. * The revamp involved massive code shuffling and grooming, numerous local * API redesigns, adding comments and incorporating DBAPI to the C++ Toolkit. * * =========================================================================== */#endif /* DBAPI_DRIVER___PUBLIC__HPP */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -