Annotation of parser3/src/include/pa_sql_driver_manager.h, revision 1.20
1.1 paf 1: /** @file
1.2 paf 2: Parser: sql driver manager decl.
1.10 parser 3: global sql driver manager, must be thread-safe
1.1 paf 4:
5: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.16 paf 6: Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru)
1.1 paf 7:
1.20 ! paf 8: $Id: pa_sql_driver_manager.h,v 1.19 2001/12/13 11:09:46 paf Exp $
1.1 paf 9: */
10:
11: #ifndef PA_SQL_DRIVER_MANAGER_H
12: #define PA_SQL_DRIVER_MANAGER_H
13:
14: #include "pa_pool.h"
15: #include "pa_sql_driver.h"
16: #include "pa_hash.h"
17: #include "pa_table.h"
18: #include "pa_string.h"
1.17 paf 19: #include "pa_cache_managers.h"
1.8 parser 20:
21: // defines
22:
23: #define MAIN_SQL_NAME "SQL"
24: #define MAIN_SQL_DRIVERS_NAME "drivers"
25:
26: // forwards
1.1 paf 27:
28: class SQL_Connection;
29:
1.11 parser 30: /// sql driver manager
1.18 paf 31: class SQL_Driver_manager : public Cache_manager {
1.14 paf 32: friend class SQL_Connection;
1.1 paf 33: public:
34:
1.15 paf 35: SQL_Driver_manager(Pool& apool);
1.19 paf 36: virtual ~SQL_Driver_manager();
1.1 paf 37:
38: /**
39: connect to specified url,
40: using driver dynamic library found in table, if not loaded yet
41: checks driver version
42: */
1.10 parser 43: SQL_Connection& get_connection(const String& url, const String& request_origin,
44: Table *protocol2driver_and_client);
1.1 paf 45:
46: private: // driver cache
47:
48: SQL_Driver *get_driver_from_cache(const String& protocol);
49: void put_driver_to_cache(const String& protocol, SQL_Driver& driver);
50:
51: private: // connection cache
52:
53: SQL_Connection *get_connection_from_cache(const String& url);
54: void put_connection_to_cache(const String& url, SQL_Connection& connection);
1.7 parser 55: private:
56: time_t prev_expiration_pass_time;
1.1 paf 57:
58: private: // for SQL_Connection
59:
60: /// caches connection
1.6 parser 61: void close_connection(const String& url, SQL_Connection& connection);
1.1 paf 62:
63: private:
64:
65: Hash driver_cache;
66: Hash connection_cache;
1.15 paf 67:
1.17 paf 68: public: // Cache_manager
1.15 paf 69:
70: virtual Value& get_status(Pool& pool, const String *source);
1.17 paf 71: virtual void maybe_expire_cache();
1.15 paf 72:
1.1 paf 73: };
74:
75: /// global
76: extern SQL_Driver_manager *SQL_driver_manager;
77:
78: #endif
E-mail: