|
|
| version 1.31, 2003/07/24 11:31:21 | version 1.35, 2003/12/10 14:54:53 |
|---|---|
| Line 8 | Line 8 |
| #ifndef PA_SQL_CONNECTION_H | #ifndef PA_SQL_CONNECTION_H |
| #define PA_SQL_CONNECTION_H | #define PA_SQL_CONNECTION_H |
| static const char* IDENT_SQL_CONNECTION_H="$Date$"; | static const char * const IDENT_SQL_CONNECTION_H="$Date$"; |
| #include "pa_sql_driver.h" | #include "pa_sql_driver.h" |
| Line 18 static const char* IDENT_SQL_CONNECTION_ | Line 18 static const char* IDENT_SQL_CONNECTION_ |
| /// @see SQL_Driver_services_impl::_throw | /// @see SQL_Driver_services_impl::_throw |
| #ifdef PA_WITH_SJLJ_EXCEPTIONS | #ifdef PA_WITH_SJLJ_EXCEPTIONS |
| #define SQL_CONNECTION_SERVICED_FUNC_GUARDED(actions) actions | #define SQL_CONNECTION_SERVICED_FUNC_GUARDED(actions) \ |
| use(); \ | |
| actions | |
| #else | #else |
| #define SQL_CONNECTION_SERVICED_FUNC_GUARDED(actions) \ | #define SQL_CONNECTION_SERVICED_FUNC_GUARDED(actions) \ |
| use(); \ | |
| if(!setjmp(fservices.mark)) { \ | if(!setjmp(fservices.mark)) { \ |
| actions; \ | actions; \ |
| } else \ | } else \ |
| Line 34 class SQL_Driver_services_impl: public S | Line 37 class SQL_Driver_services_impl: public S |
| public: | public: |
| SQL_Driver_services_impl(): furl(0) {} | SQL_Driver_services_impl(): furl(0) {} |
| void set_url(const String& aurl) { furl=&aurl;} | void set_url(const String& aurl) { furl=&aurl;} |
| const String& url_without_login() const; | |
| override void *malloc(size_t size) { return pa_malloc(size); } | override void *malloc(size_t size) { return pa_malloc(size); } |
| override void *malloc_atomic(size_t size) { return pa_malloc_atomic(size); } | override void *malloc_atomic(size_t size) { return pa_malloc_atomic(size); } |
| Line 70 public: | Line 74 public: |
| throw fexception; | throw fexception; |
| #endif | #endif |
| } | } |
| private: | |
| const String& url_without_login() const; | |
| }; | }; |
| /// SQL connection. handy wrapper around low level SQL_Driver | /// SQL connection. handy wrapper around low level SQL_Driver |
| Line 93 public: | Line 94 public: |
| time_used(0), | time_used(0), |
| marked_to_rollback(false) { | marked_to_rollback(false) { |
| } | } |
| SQL_Driver_services_impl& services() { return fservices; } | |
| const String& get_url() { return furl; } | const String& get_url() { return furl; } |
| Line 103 public: | Line 106 public: |
| time_used=time(0); // they started to use at this time | time_used=time(0); // they started to use at this time |
| } | } |
| bool expired(time_t older_dies) { | bool expired(time_t older_dies) { |
| return /*!freferences && */time_used<older_dies; | return time_used<older_dies; |
| } | } |
| time_t get_time_used() { return time_used; } | time_t get_time_used() { return time_used; } |
| Line 120 public: | Line 123 public: |
| SQL_CONNECTION_SERVICED_FUNC_GUARDED( | SQL_CONNECTION_SERVICED_FUNC_GUARDED( |
| return fdriver.ping(fservices, fconnection) | return fdriver.ping(fservices, fconnection) |
| ); | ); |
| return 0; // never reached | |
| } | } |
| const char* quote(const char* str, unsigned int length) { | const char* quote(const char* str, unsigned int length) { |
| SQL_CONNECTION_SERVICED_FUNC_GUARDED( | SQL_CONNECTION_SERVICED_FUNC_GUARDED( |
| return fdriver.quote(fservices, fconnection, str, length) | return fdriver.quote(fservices, fconnection, str, length) |
| ); | ); |
| // return 0; // never reached | |
| } | } |
| void query( | void query( |