Annotation of parser3/src/include/pa_db_manager.h, revision 1.5
1.1 parser 1: /** @file
2: Parser: sql driver manager decl.
3: global sql driver manager, must be thread-safe
4:
5: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
6: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
7:
1.5 ! paf 8: $Id: pa_db_manager.h,v 1.4 2001/10/26 13:48:18 paf Exp $
1.1 parser 9: */
10:
1.3 paf 11: #ifndef PA_DB_MANAGER_H
12: #define PA_DB_MANAGER_H
1.1 parser 13:
14: #include "pa_config_includes.h"
15: #include "pa_pool.h"
16: #include "pa_hash.h"
1.4 paf 17: #include "pa_db_connection.h"
1.5 ! paf 18:
1.1 parser 19: // defines
20:
21: // forwards
22:
23: /// sql driver manager
24: class DB_Manager : public Pooled {
25: friend DB_Connection;
26: public:
27:
28: DB_Manager(Pool& pool);
29: ~DB_Manager();
30:
31: /**
1.3 paf 32: connect to specified db_home,
1.1 parser 33: using driver dynamic library found in table, if not loaded yet
34: checks driver version
35: */
1.4 paf 36: DB_Connection_ptr get_connection_ptr(const String& db_home, const String *source);
1.1 parser 37:
1.3 paf 38: private: // connection cache, never expires
1.1 parser 39:
1.3 paf 40: DB_Connection *get_connection_from_cache(const String& db_home);
41: void put_connection_to_cache(const String& db_home, DB_Connection& connection);
1.1 parser 42: void maybe_expire_connection_cache();
43: private:
44: time_t prev_expiration_pass_time;
45:
46: private: // for DB_Connection
47:
48: private:
49:
50: Hash connection_cache;
51:
52: };
53:
54: /// global
55: extern DB_Manager *DB_manager;
56:
57: #endif
E-mail: