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