--- parser3/src/main/pa_sql_driver_manager.C 2003/01/28 09:48:16 1.69.2.4 +++ parser3/src/main/pa_sql_driver_manager.C 2003/01/31 12:10:47 1.69.2.8 @@ -5,14 +5,15 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_SQL_DRIVER_MANAGER_C="$Date: 2003/01/28 09:48:16 $"; +static const char* IDENT_SQL_DRIVER_MANAGER_C="$Date: 2003/01/31 12:10:47 $"; #include "pa_sql_driver_manager.h" #include "ltdl.h" +#include "pa_threads.h" #include "pa_sql_connection.h" #include "pa_exception.h" #include "pa_common.h" -#include "pa_threads.h" +#include "pa_value_includes.h" #include "pa_vhash.h" #include "pa_vtable.h" @@ -27,7 +28,7 @@ const time_t CHECK_EXPIRED_CONNECTIONS_S // helpers -ConstStringPtr SQL_Driver_services_impl::url_without_login() const { +StringPtr SQL_Driver_services_impl::url_without_login() const { StringPtr result(new String); *result << furl->mid(0, furl->pos(":")) << "://****"; @@ -56,6 +57,8 @@ static void expire_connections( SQL_Driver_manager::SQL_Driver_manager(): prev_expiration_pass_time(0) { + + cache_managers.put(StringPtr(new String("sql")), this); } SQL_Driver_manager::~SQL_Driver_manager() { @@ -63,8 +66,8 @@ SQL_Driver_manager::~SQL_Driver_manager( } /// @param aurl protocol://[driver-dependent] -SQL_ConnectionPtr SQL_Driver_manager::get_connection(Pool& apool, ConstStringPtr arequest_url, - ConstStringPtr aorigin, +SQL_ConnectionPtr SQL_Driver_manager::get_connection(Pool& apool, StringPtr arequest_url, + StringPtr aorigin, Table *protocol2driver_and_client) { // we have table for locating protocol's library if(!protocol2driver_and_client) @@ -91,26 +94,23 @@ SQL_ConnectionPtr SQL_Driver_manager::ge arequest_url->size()?arequest_url:aorigin, "connection string must start with protocol://"); - // make global_url C-string on global pool - char *global_url_cstr=arequest_url->cstr(driver_cache_pool); - StringPtr global_url(new String(global_url_cstr)); + // make global_url C-string on driver_cache_pool pool + StringPtr global_url(new String(arequest_url->cstr(driver_cache_pool))); request_url_cstr=arequest_url->cstr(); char *request_protocol_cstr=lsplit(&request_url_cstr, ':'); // skip "//" after ':' while(*request_url_cstr=='/') request_url_cstr++; - // make global_protocol C-string on global pool - char *global_protocol_cstr=driver_cache_pool.copy(request_protocol_cstr); - // make global_protocol string on global pool - StringPtr global_protocol(new String(global_protocol_cstr)); + // make global_protocol C-string on driver_cache_pool pool + StringPtr global_protocol(new String(driver_cache_pool.copy(request_protocol_cstr))); SQL_Driver *driver; // first trying to get cached driver if(!(driver=get_driver_from_cache(global_protocol))) { // no cached - ConstStringPtr library(0); - ConstStringPtr dlopen_file_spec(0); + StringPtr library(0); + StringPtr dlopen_file_spec(0); if(protocol2driver_and_client->locate(0, global_protocol)) { if(!(library=protocol2driver_and_client->item(1)) || library->size()==0) throw Exception("parser.runtime", @@ -272,7 +272,7 @@ static void add_connections_to_status_ca add_connection_to_status_cache_table(iter.next(), info); }*/ /// @todo convert to object_ptr -ValuePtr SQL_Driver_manager::get_status(Pool& pool, ConstStringPtr source) { +ValuePtr SQL_Driver_manager::get_status(Pool& pool, StringPtr source) { ValuePtr result(new VHash); /* // cache