Annotation of parser3/src/include/pa_sql_driver_manager.h, revision 1.15

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)
                      6:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
                      7: 
1.15    ! paf         8:        $Id: pa_sql_driver_manager.h,v 1.14 2001/10/29 08:23:49 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.15    ! paf        20: #include "pa_status_provider.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.15    ! paf        32: class SQL_Driver_manager : public Pooled, public Status_provider {
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:        void maybe_expire_connection_cache();
                     57: private:
                     58:        time_t prev_expiration_pass_time;
1.1       paf        59: 
                     60: private: // for SQL_Connection
                     61: 
                     62:        /// caches connection
1.6       parser     63:        void close_connection(const String& url, SQL_Connection& connection);
1.1       paf        64: 
                     65: private:
                     66: 
                     67:        Hash driver_cache;
                     68:        Hash connection_cache;
1.15    ! paf        69: 
        !            70: public: // Status_provider
        !            71: 
        !            72:        virtual Value& get_status(Pool& pool, const String *source);
        !            73: 
1.1       paf        74: };
                     75: 
                     76: /// global
                     77: extern SQL_Driver_manager *SQL_driver_manager;
                     78: 
                     79: #endif

E-mail: