--- parser3/src/include/pa_sql_connection.h 2001/05/17 13:23:28 1.9 +++ parser3/src/include/pa_sql_connection.h 2001/07/23 11:19:25 1.11 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_sql_connection.h,v 1.9 2001/05/17 13:23:28 parser Exp $ + $Id: pa_sql_connection.h,v 1.11 2001/07/23 11:19:25 parser Exp $ */ #ifndef PA_SQL_CONNECTION_H @@ -23,20 +23,27 @@ public: SQL_Connection(Pool& pool, const String& aurl, SQL_Driver& adriver) : Pooled(pool), furl(aurl), - fdriver(adriver) { + fdriver(adriver), + fconnection(0), + time_stamp(0) { } void set_services(SQL_Driver_services *aservices) { + time_stamp=time(0); // they started to use at this time fservices=aservices; } + bool expired(time_t older_dies) { + return time_stampclose_connection(furl, *this); } + bool connected() { return fconnection!=0; } void connect(char *used_only_in_connect_url_cstr) { fdriver.connect(used_only_in_connect_url_cstr, *fservices, &fconnection); } - void disconnect() { fdriver.disconnect(*fservices, fconnection); } + void disconnect() { fdriver.disconnect(*fservices, fconnection); fconnection=0; } void commit() { fdriver.commit(*fservices, fconnection); } void rollback() { fdriver.rollback(*fservices, fconnection); } bool ping() { return fdriver.ping(*fservices, fconnection); } @@ -46,12 +53,10 @@ public: void query( const char *statement, unsigned long offset, unsigned long limit, - unsigned int *column_count, SQL_Driver::Cell **columns, - unsigned long *row_count, SQL_Driver::Cell ***rows) { + SQL_Driver_query_event_handlers& handlers) { fdriver.query(*fservices, fconnection, statement, offset, limit, - column_count, columns, - row_count, rows); + handlers); } @@ -61,6 +66,7 @@ private: SQL_Driver& fdriver; SQL_Driver_services *fservices; void *fconnection; + time_t time_stamp; }; #endif