Annotation of parser3/src/include/pa_db_manager.h, revision 1.3

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.3     ! paf         8:        $Id: pa_db_manager.h,v 1.2 2001/10/23 12:41:05 parser 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"
                     17: 
                     18: // defines
                     19: 
                     20: // forwards
                     21: 
                     22: class DB_Connection;
                     23: 
                     24: /// sql driver manager
                     25: class DB_Manager : public Pooled {
                     26:        friend DB_Connection;
                     27: public:
                     28: 
                     29:        DB_Manager(Pool& pool);
                     30:        ~DB_Manager();
                     31: 
                     32:        /** 
1.3     ! paf        33:                connect to specified db_home, 
1.1       parser     34:                using driver dynamic library found in table, if not loaded yet
                     35:                checks driver version
                     36:        */
1.3     ! paf        37:        DB_Connection& get_connection(const String& db_home, const String& request_origin);
1.1       parser     38: 
1.3     ! paf        39: private: // connection cache, never expires
1.1       parser     40: 
1.3     ! paf        41:        DB_Connection *get_connection_from_cache(const String& db_home);
        !            42:        void put_connection_to_cache(const String& db_home, DB_Connection& connection);
1.1       parser     43:        void maybe_expire_connection_cache();
                     44: private:
                     45:        time_t prev_expiration_pass_time;
                     46: 
                     47: private: // for DB_Connection
                     48: 
                     49:        /// caches connection
1.3     ! paf        50:        void close_connection(const String& db_home, DB_Connection& connection);
1.1       parser     51: 
                     52: private:
                     53: 
                     54:        Hash connection_cache;
                     55: 
                     56: };
                     57: 
                     58: /// global
                     59: extern DB_Manager *DB_manager;
                     60: 
                     61: #endif

E-mail: