|
|
| version 1.27.12.1, 2006/04/09 12:25:04 | version 1.38, 2026/04/25 13:38:46 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: sql driver manager implementation. | Parser: sql driver manager implementation. |
| Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru> |
| */ | */ |
| #include "pa_config_includes.h" | #include "pa_config_includes.h" |
| #ifdef XML | #ifdef XML |
| static const char * const IDENT_STYLESHEET_MANAGER_C="$Date$"; | |
| #include "pa_stylesheet_manager.h" | #include "pa_stylesheet_manager.h" |
| #include "pa_exception.h" | #include "pa_exception.h" |
| #include "pa_common.h" | #include "pa_common.h" |
| Line 17 static const char * const IDENT_STYLESHE | Line 15 static const char * const IDENT_STYLESHE |
| #include "pa_vhash.h" | #include "pa_vhash.h" |
| #include "pa_vtable.h" | #include "pa_vtable.h" |
| volatile const char * IDENT_PA_STYLESHEET_MANAGER_C="$Id$" IDENT_PA_STYLESHEET_MANAGER_H; | |
| // globals | // globals |
| Stylesheet_manager* stylesheet_manager=0; | Stylesheet_manager* stylesheet_manager=0; |
| Line 32 static void expire_connection(Stylesheet | Line 32 static void expire_connection(Stylesheet |
| if(connection.connected() && connection.expired(older_dies)) | if(connection.connected() && connection.expired(older_dies)) |
| connection.disconnect(); | connection.disconnect(); |
| } | } |
| static void expire_connections( | static void expire_connections(Stylesheet_manager::connection_cache_type::key_type /*key*/, Stylesheet_manager::connection_cache_type::value_type stack, time_t older_dies) { |
| Stylesheet_manager::connection_cache_type::key_type /*key*/, | |
| Stylesheet_manager::connection_cache_type::value_type stack, | |
| time_t older_dies) { | |
| for(size_t i=0; i<stack->top_index(); i++) | for(size_t i=0; i<stack->top_index(); i++) |
| expire_connection(*stack->get(i), older_dies); | expire_connection(*stack->get(i), older_dies); |
| } | } |
| Line 55 Stylesheet_manager::~Stylesheet_manager( | Line 52 Stylesheet_manager::~Stylesheet_manager( |
| connection_cache.for_each<time_t>(expire_connections, time(0)+(time_t)10/*=in future=expire all*/); | connection_cache.for_each<time_t>(expire_connections, time(0)+(time_t)10/*=in future=expire all*/); |
| } | } |
| Stylesheet_connection_ptr Stylesheet_manager::get_connection(String::Body file_spec) { | Stylesheet_connection* Stylesheet_manager::get_connection(String::Body file_spec) { |
| Stylesheet_connection* result=get_connection_from_cache(file_spec); | Stylesheet_connection* result=get_connection_from_cache(file_spec); |
| if(!result) | return result ? result : new Stylesheet_connection(file_spec); |
| result=new Stylesheet_connection(file_spec); | |
| return Stylesheet_connection_ptr(result); | |
| } | } |
| void Stylesheet_manager::close_connection(String::Body file_spec, Stylesheet_connection& connection) { | void Stylesheet_manager::close_connection(String::Body file_spec, Stylesheet_connection& connection) { |
| Line 81 Stylesheet_connection* Stylesheet_manage | Line 76 Stylesheet_connection* Stylesheet_manage |
| return 0; | return 0; |
| } | } |
| void Stylesheet_manager::put_connection_to_cache(String::Body file_spec, | void Stylesheet_manager::put_connection_to_cache(String::Body file_spec, Stylesheet_connection& connection) { |
| Stylesheet_connection& connection) { | |
| SYNCHRONIZED; | SYNCHRONIZED; |
| connection_cache_type::value_type connections=connection_cache.get(file_spec); | connection_cache_type::value_type connections=connection_cache.get(file_spec); |
| Line 116 static void add_connection_to_status_cac | Line 110 static void add_connection_to_status_cac |
| *table+=&row; | *table+=&row; |
| } | } |
| } | } |
| static void add_connections_to_status_cache_table( | static void add_connections_to_status_cache_table(Stylesheet_manager::connection_cache_type::key_type /*key*/, Stylesheet_manager::connection_cache_type::value_type stack, Table* table) { |
| Stylesheet_manager::connection_cache_type::key_type /*key*/, | for(Array_iterator<Stylesheet_connection*> i(*stack); i; ) |
| Stylesheet_manager::connection_cache_type::value_type stack, Table* table) | |
| { | |
| for(Array_iterator<Stylesheet_connection*> i(*stack); i.has_next(); ) | |
| add_connection_to_status_cache_table(*i.next(), table); | add_connection_to_status_cache_table(*i.next(), table); |
| } | } |