Annotation of parser3/src/include/pa_sql_connection.h, revision 1.3
1.1 paf 1: /** @file
2: Parser: sql connection decl.
3:
4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
5:
6: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
7:
1.3 ! paf 8: $Id: pa_sql_connection.h,v 1.2 2001/04/05 11:01:55 paf Exp $
1.1 paf 9: */
10:
11: #ifndef PA_SQL_CONNECTION_H
12: #define PA_SQL_CONNECTION_H
13:
14: #include "pa_pool.h"
15: #include "pa_sql_driver.h"
16: #include "pa_exception.h"
17:
18: /// sql connection
19: class SQL_Connection : public Pooled {
20:
21: public:
22:
23: void set_services(Services_for_SQL_driver *services) {
24: fdriver.set_services(services);
25: }
26:
27: SQL_Connection(Pool& pool,
28: const String& aurl,
29: SQL_Driver& adriver, Services_for_SQL_driver& services,
30: char *url_cstr) : Pooled(pool),
31: furl(aurl),
32: fdriver(adriver) {
33:
1.2 paf 34: set_services(&services); // associate with services[request]
35: fdriver.connect(url_cstr, &connection);
1.1 paf 36: }
37:
38: void close() {
1.2 paf 39: set_services(0); // deassociate from services[request]
1.1 paf 40: SQL_driver_manager->close_connection(furl, *this);
41: }
42:
1.2 paf 43: void disconnect() { fdriver.disconnect(connection); }
44: void commit() { fdriver.commit(connection); }
45: void rollback() { fdriver.rollback(connection); }
1.3 ! paf 46: bool ping() { return fdriver.ping(connection); }
1.2 paf 47: void query(
1.3 ! paf 48: const char *statement, unsigned long offset, unsigned long limit,
1.2 paf 49: unsigned int *column_count, SQL_Driver::Cell **columns,
50: unsigned long *row_count, SQL_Driver::Cell ***rows) {
51: fdriver.query(connection,
1.3 ! paf 52: statement, offset, limit,
1.2 paf 53: column_count, columns,
54: row_count, rows);
55: }
56:
1.1 paf 57:
58: private:
59:
60: SQL_Driver& fdriver;
1.2 paf 61: void *connection;
1.1 paf 62: const String& furl;
63: };
64:
65: #endif
E-mail: