Annotation of parser3/src/include/pa_sql_driver_manager.h, revision 1.26.2.2
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:
1.26 paf 5: Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com)
1.23 paf 6: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1 paf 7: */
8:
9: #ifndef PA_SQL_DRIVER_MANAGER_H
10: #define PA_SQL_DRIVER_MANAGER_H
1.24 paf 11:
1.26.2.2! paf 12: static const char* IDENT_SQL_DRIVER_MANAGER_H="$Date: 2003/01/27 16:00:41 $";
1.1 paf 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.26.2.2! paf 20: #include "pa_stack.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;
1.26.2.1 paf 30: DECLARE_OBJECT_PTR (SQL_Connection)
1.1 paf 31:
1.11 parser 32: /// sql driver manager
1.26.2.1 paf 33: class SQL_Driver_manager: public Cache_manager {
1.14 paf 34: friend class SQL_Connection;
1.1 paf 35: public:
36:
1.26.2.1 paf 37: SQL_Driver_manager();
38: override ~SQL_Driver_manager();
1.1 paf 39:
40: /**
41: connect to specified url,
42: using driver dynamic library found in table, if not loaded yet
43: checks driver version
44: */
1.26.2.2! paf 45: SQL_ConnectionPtr get_connection(Pool& pool, ConstStringPtr aurl, ConstStringPtr aorigin,
1.10 parser 46: Table *protocol2driver_and_client);
1.1 paf 47:
48: private: // driver cache
49:
1.26.2.2! paf 50: SQL_Driver *get_driver_from_cache(ConstStringPtr protocol);
! 51: void put_driver_to_cache(ConstStringPtr protocol, SQL_Driver& driver);
1.1 paf 52:
53: private: // connection cache
54:
1.26.2.2! paf 55: SQL_Connection *get_connection_from_cache(ConstStringPtr url);
! 56: void put_connection_to_cache(ConstStringPtr url, SQL_Connection& connection);
1.7 parser 57: private:
58: time_t prev_expiration_pass_time;
1.1 paf 59:
60: private: // for SQL_Connection
61:
62: /// caches connection
1.26.2.2! paf 63: void close_connection(ConstStringPtr url, SQL_Connection& connection);
1.1 paf 64:
65: private:
66:
1.26.2.1 paf 67: Hash<const String&, SQL_Driver *> driver_cache;
1.26.2.2! paf 68: Hash<const String&, Stack<SQL_Connection&> *> connection_cache;
1.15 paf 69:
1.17 paf 70: public: // Cache_manager
1.15 paf 71:
1.26.2.2! paf 72: override ValuePtr get_status(Pool& pool, ConstStringPtr source);
! 73: override void maybe_expire_cache();
1.15 paf 74:
1.1 paf 75: };
76:
77: /// global
1.26.2.1 paf 78: extern SQL_Driver_manager SQL_driver_manager;
1.1 paf 79:
80: #endif
E-mail: