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

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.2     ! paf         8:        $Id: pa_sql_connection.h,v 1.1 2001/04/05 08:09:21 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); }
        !            46:        void query(
        !            47:                const char *statement, 
        !            48:                unsigned int *column_count, SQL_Driver::Cell **columns,
        !            49:                unsigned long *row_count, SQL_Driver::Cell ***rows) { 
        !            50:                fdriver.query(connection, 
        !            51:                        statement, 
        !            52:                        column_count, columns,
        !            53:                        row_count, rows);
        !            54:        }
        !            55: 
1.1       paf        56: 
                     57: private:
                     58: 
                     59:        SQL_Driver& fdriver;
1.2     ! paf        60:        void *connection;
1.1       paf        61:        const String& furl;
                     62: };
                     63: 
                     64: #endif

E-mail: