00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef RESOURCEPOOL_SQL_SQLFACTORYINTERFACE_HH
00025 #define RESOURCEPOOL_SQL_SQLFACTORYINTERFACE_HH
00026
00027 #include "util/Clone.hh"
00028 #include "mm/gc_ptr.hh"
00029 #include "ResourcePool/ResourcePoolEventObserver.hh"
00030
00031 namespace fatalmind {
00032 namespace SQL {
00033
00049 class SQLFactoryInterface: public Clone {
00050 public:
00051 SQLFactoryInterface(ResourcePoolEventObserver& e)
00052 :observer(e.clone<ResourcePoolEventObserver>())
00053 {
00054 Event.PREPARE = observer->registerEvent("PREPARE");
00055 Event.EXECUTE = observer->registerEvent("EXECUTE");
00056 Event.EXECUTE_FAIL = observer->registerEvent("EXECUTE_FAIL");
00057 Event.FETCH = observer->registerEvent("FETCH");
00058 Event.COMMIT = observer->registerEvent("COMMIT");
00059 Event.ROLLBACK= observer->registerEvent("ROLLBACK");
00060
00061 getEventObserver()->setDefaultEventMask();
00062 };
00063
00064 gc_ptr<ResourcePoolEventObserver> getEventObserver() const {
00065 return observer;
00066 }
00067
00068
00069 enum databaseType_t { UNDEF, OCI, MYSQL, MYSQLTX };
00070 private:
00071 struct Events {
00072 ResourcePoolEventObserver::event_t PREPARE;
00073 ResourcePoolEventObserver::event_t EXECUTE;
00074 ResourcePoolEventObserver::event_t EXECUTE_FAIL;
00075 ResourcePoolEventObserver::event_t FETCH;
00076 ResourcePoolEventObserver::event_t COMMIT;
00077 ResourcePoolEventObserver::event_t ROLLBACK;
00078 } Event;
00079
00080 const gc_ptr<ResourcePoolEventObserver> observer;
00081 };
00082
00083 }
00084 }
00085
00086 #endif