--- parser3/src/main/pa_sql_driver_manager.C 2001/10/29 08:05:37 1.43 +++ parser3/src/main/pa_sql_driver_manager.C 2001/10/31 14:58:10 1.48 @@ -4,7 +4,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_sql_driver_manager.C,v 1.43 2001/10/29 08:05:37 paf Exp $ + $Id: pa_sql_driver_manager.C,v 1.48 2001/10/31 14:58:10 paf Exp $ */ #include "pa_sql_driver_manager.h" @@ -32,7 +32,7 @@ public: furl(aurl) { } - virtual void *malloc(size_t size) { return Pooled::malloc(size); } + virtual void *malloc(size_t size) { return Pooled::malloc(size, 8); } virtual void *calloc(size_t size) { return Pooled::calloc(size); } /** @@ -41,8 +41,11 @@ public: and from there... #2 propagate_exception() */ virtual void _throw(const char *comment) { + String& protocol=*NEW String(pool()); + /// hiding passwords and addresses from accidental show [imagine user forgot @exception] + protocol << furl.mid(0, furl.pos(":")) << "://****"; e=Exception(0, 0, - &furl, + &protocol, comment); longjmp(mark, 1); @@ -97,11 +100,17 @@ SQL_Connection& SQL_Driver_manager::get_ &request_url, "$"MAIN_SQL_NAME":"MAIN_SQL_DRIVERS_NAME" table must be defined"); + // construct services[request] (deassociates at close) + SQL_Driver_services *services=new(pool) SQL_Driver_services_impl(pool, request_url); + // first trying to get cached connection SQL_Connection *result=get_connection_from_cache(request_url); - if(result && !result->ping()) { // we have some cached connection, is it pingable? - result->disconnect(); // kill unpingabe=dead connection - result=0; + if(result) { + result->set_services(services); + if(!result->ping()) { // we have some cached connection, is it pingable? + result->disconnect(); // kill unpingabe=dead connection + result=0; + } } char *request_url_cstr; @@ -115,7 +124,7 @@ SQL_Connection& SQL_Driver_manager::get_ "connection string must start with protocol://"); // NOTE: not THROW, but PTHROW // make global_url C-string on global pool - request_url_cstr=request_url.cstr(String::UL_AS_IS); + request_url_cstr=request_url.cstr(); char *global_url_cstr=(char *)malloc(strlen(request_url_cstr)+1); strcpy(global_url_cstr, request_url_cstr); // make global_url string on global pool @@ -202,10 +211,10 @@ SQL_Connection& SQL_Driver_manager::get_ // associate with services[request] // NOTE: never freed up! result=new(this->pool()) SQL_Connection(this->pool(), global_url, *driver); + // associate with services[request] (deassociates at close) + result->set_services(services); } - // associate with services[request] (deassociates at close) - result->set_services(new(pool) SQL_Driver_services_impl(pool, request_url)); // if not connected yet, do that now, when result has services if(!result->connected()) result->connect(request_url_cstr);