Annotation of parser3/src/include/pa_sql_connection.h, revision 1.9

1.1       paf         1: /** @file
1.9     ! parser      2:        Parser: sql fconnection decl.
1.1       paf         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.9     ! parser      8:        $Id: pa_sql_connection.h,v 1.8 2001/05/17 12:51:05 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.9     ! parser     19: /// SQL fconnection. handy wrapper around low level SQL_Driver
1.1       paf        20: class SQL_Connection : public Pooled {
                     21: 
                     22: public:
                     23: 
1.9     ! parser     24:        SQL_Connection(Pool& pool, const String& aurl, SQL_Driver& adriver) : Pooled(pool),
1.1       paf        25:                furl(aurl),
                     26:                fdriver(adriver) {
1.9     ! parser     27:        }
        !            28:        void set_services(SQL_Driver_services *aservices) {
        !            29:                fservices=aservices;
1.1       paf        30:        }
                     31: 
1.9     ! parser     32:        void close() {
        !            33:                SQL_driver_manager->close_connection(furl, *this);
1.1       paf        34:        }
                     35: 
1.9     ! parser     36:        void connect(char *used_only_in_connect_url_cstr) { 
        !            37:                fdriver.connect(used_only_in_connect_url_cstr, *fservices, &fconnection);
        !            38:        }
        !            39:        void disconnect() { fdriver.disconnect(*fservices, fconnection); }
        !            40:        void commit() { fdriver.commit(*fservices, fconnection); }
        !            41:        void rollback() { fdriver.rollback(*fservices, fconnection); }
        !            42:        bool ping() { return fdriver.ping(*fservices, fconnection); }
1.4       paf        43:        uint quote(char *to, const char *from, unsigned int length) {
1.9     ! parser     44:                return fdriver.quote(*fservices, fconnection, to, from, length);
1.4       paf        45:        }
                     46: 
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) { 
1.9     ! parser     51:                fdriver.query(*fservices, fconnection, 
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: 
1.9     ! parser     60:        const String& furl;
1.1       paf        61:        SQL_Driver& fdriver;
1.9     ! parser     62:        SQL_Driver_services *fservices;
        !            63:        void *fconnection;
1.1       paf        64: };
                     65: 
                     66: #endif

E-mail: