123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #ifndef CPPDB_CONN_MANAGER_H
- #define CPPDB_CONN_MANAGER_H
- #include <cppdb/defs.h>
- #include <cppdb/ref_ptr.h>
- #include <mutex>
- #include <map>
- #include <string>
- #include <memory>
- namespace cppdb {
- class pool;
- class connection_info;
- namespace backend {
- class connection;
- }
-
-
-
-
-
-
-
- class CPPDB_API connections_manager {
- connections_manager();
-
- #ifndef __BORLANDC__
- ~connections_manager();
- #endif
- connections_manager(connections_manager const &);
- void operator = (connections_manager const &);
- public:
-
-
-
- static connections_manager &instance();
-
-
-
- ref_ptr<backend::connection> open(std::string const &cs);
-
-
-
- ref_ptr<backend::connection> open(connection_info const &ci);
-
-
-
- void gc();
- private:
- struct data;
- std::unique_ptr<data> d;
- std::mutex lock_;
- typedef std::map<std::string,ref_ptr<pool> > connections_type;
- connections_type connections_;
- };
- }
- #endif
|