00001 /* 00002 * $Id: SQLDriver.h,v 1.14 2003/09/09 13:58:26 mindstorm2600 Exp $ 00003 */ 00004 #ifndef __CLAW_SQLDRIVER_H__ 00005 #define __CLAW_SQLDRIVER_H__ 00006 #include<DatabaseInterface.h> 00007 #include<Plugin.h> 00008 #include<ResultSet.h> 00009 #include<DBDriverInfo.h> 00010 #include<SQLField.h> 00011 00012 namespace clawsoft{ 00013 00014 class ResultSet; 00015 00023 class SQLDriver:public DatabaseInterface{ 00024 private: 00025 protected: 00027 Plugin *__drv; 00028 bool __do_auto_commit; 00029 bool (*__drv_init)(SQLDriver *__me); 00030 bool (*__drv_cleanup)(); 00031 Uint32 (*__drv_connect)(const char *srvr, const char *usr, const char *pass, const int port); 00032 Uint32 (*__drv_disconnect)(Uint32 handle); 00033 bool (*__drv_getVersionInfo)(DBDriverInfo **i); 00034 bool (*__drv_commit)(Uint32 handle); 00035 ResultSet *(*__drv_query)(Uint32 handle, const char *cmd); 00036 bool (*__drv_usedb)(Uint32 handle, const char *dbname); 00037 00038 // The following method pointers are for ResultSet usage 00039 SQLField *(*__drv_fetch_next_row)(Uint32 __res_handle); 00040 int (*__drv_numcols)(Uint32 __res_handle); 00041 int (*__drv_numrows)(Uint32 __res_handle); 00042 bool __is_loaded; 00043 public: 00046 SQLDriver(const String &soname); 00051 virtual ~SQLDriver(); 00054 void load(); 00058 void getVersionInfo(DBDriverInfo **info); 00073 virtual Uint32 connect(const String &server, const String &user, const String &pass, int port = 0); 00079 virtual ResultSet *query(Uint32 __handle, const String &command); 00083 virtual bool disconnect(Uint32 __handle); 00091 virtual void setAutoCommit(bool val = true); 00097 virtual void commit(Uint32 __handle); 00101 virtual void useDB(Uint32 __handle, const String &dbname); 00104 virtual const int numRows(Uint32 __res_handle); 00107 virtual const int numCols(Uint32 __res_handle); 00110 SQLField *fetchRow(Uint32 __res_handle); 00111 }; 00112 }; 00113 00114 #endif
Authors:
Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara
Powered by: