Annotation of parser3/src/include/pa_sql_connection.h, revision 1.8
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.8 ! parser 8: $Id: pa_sql_connection.h,v 1.7 2001/05/17 10:22:24 parser Exp $
1.1 paf 9: */
10:
11: #ifndef PA_SQL_CONNECTION_H
12: #define PA_SQL_CONNECTION_H
13:
1.7 parser 14: #include "pa_config_includes.h"
1.1 paf 15: #include "pa_pool.h"
16: #include "pa_sql_driver.h"
1.4 paf 17: #include "pa_sql_driver_manager.h"
1.1 paf 18:
1.4 paf 19: /// SQL connection. handy wrapper around low level SQL_Driver
1.1 paf 20: class SQL_Connection : public Pooled {
21:
22: public:
23:
1.5 paf 24: void set_services(SQL_Driver_services *services) {
1.1 paf 25: fdriver.set_services(services);
26: }
27:
28: SQL_Connection(Pool& pool,
29: const String& aurl,
1.8 ! parser 30: SQL_Driver& adriver,
1.6 parser 31: char *used_only_in_constructor_url_cstr) : Pooled(pool),
1.1 paf 32: furl(aurl),
33: fdriver(adriver) {
1.6 parser 34: fdriver.connect(used_only_in_constructor_url_cstr, &connection);
1.1 paf 35: }
36:
1.8 ! parser 37: void close(Pool& pool) {
! 38: SQL_driver_manager->close_connection(furl, *this, pool);
1.1 paf 39: }
40:
1.2 paf 41: void disconnect() { fdriver.disconnect(connection); }
42: void commit() { fdriver.commit(connection); }
43: void rollback() { fdriver.rollback(connection); }
1.3 paf 44: bool ping() { return fdriver.ping(connection); }
1.4 paf 45: uint quote(char *to, const char *from, unsigned int length) {
46: return fdriver.quote(connection, to, from, length);
47: }
48:
1.2 paf 49: void query(
1.3 paf 50: const char *statement, unsigned long offset, unsigned long limit,
1.2 paf 51: unsigned int *column_count, SQL_Driver::Cell **columns,
52: unsigned long *row_count, SQL_Driver::Cell ***rows) {
53: fdriver.query(connection,
1.3 paf 54: statement, offset, limit,
1.2 paf 55: column_count, columns,
56: row_count, rows);
57: }
58:
1.1 paf 59:
60: private:
61:
62: SQL_Driver& fdriver;
1.2 paf 63: void *connection;
1.1 paf 64: const String& furl;
65: };
66:
67: #endif
E-mail: