--- parser3/src/include/pa_sql_connection.h 2002/03/25 09:40:01 1.24 +++ parser3/src/include/pa_sql_connection.h 2002/09/04 14:59:54 1.28 @@ -3,13 +3,13 @@ Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) - - $Id: pa_sql_connection.h,v 1.24 2002/03/25 09:40:01 paf Exp $ */ #ifndef PA_SQL_CONNECTION_H #define PA_SQL_CONNECTION_H +static const char* IDENT_SQL_CONNECTION_H="$Date: 2002/09/04 14:59:54 $"; + #include "pa_pool.h" #include "pa_sql_driver.h" #include "pa_sql_driver_manager.h" @@ -17,11 +17,15 @@ // defines /// @see SQL_Driver_services_impl::_throw -#define SQL_CONNECTION_SERVICED_FUNC_GUARDED(actions) \ - if(!fservices || !setjmp(fservices->mark)) { \ - actions; \ - } else \ - fservices->propagate_exception(); +#ifdef PA_WITH_SJLJ_EXCEPTIONS + #define SQL_CONNECTION_SERVICED_FUNC_GUARDED(actions) actions +#else + #define SQL_CONNECTION_SERVICED_FUNC_GUARDED(actions) \ + if(!fservices || !setjmp(fservices->mark)) { \ + actions; \ + } else \ + fservices->propagate_exception(); +#endif /// SQL connection. handy wrapper around low level SQL_Driver class SQL_Connection : public Pooled { @@ -72,12 +76,20 @@ public: void query( const char *statement, unsigned long offset, unsigned long limit, - SQL_Driver_query_event_handlers& handlers) { - SQL_CONNECTION_SERVICED_FUNC_GUARDED( - fdriver.query(*fservices, fconnection, - statement, offset, limit, - handlers) - ); + SQL_Driver_query_event_handlers& handlers, + const String& source) { + try { + SQL_CONNECTION_SERVICED_FUNC_GUARDED( + fdriver.query(*fservices, fconnection, + statement, offset, limit, + handlers) + ); + } catch(const Exception& e) { // query problem + // give more specific source [were url] + throw Exception("sql.execute", + &source, + "%s", e.comment()); + } } void mark_to_rollback() {