Changeset 1167:8160e1eba359


Ignore:
Timestamp:
02/25/09 05:52:25 (3 years ago)
Author:
niam
Branch:
libdodo
Message:

header cleanup in cgi::* and data::base::*

Files:
1 added
1 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/libdodo/cgiBasicExchange.h

    r1166 r1167  
    3333#include <libdodo/directives.h> 
    3434 
    35 #include <libdodo/types.h> 
    3635#include <libdodo/cgiExchange.h> 
    3736#include <libdodo/ioStdio.h> 
  • trunk/include/libdodo/cgiBasicServer.h

    r1160 r1167  
    3333#include <libdodo/directives.h> 
    3434 
    35 #include <libdodo/types.h> 
    3635#include <libdodo/cgiServer.h> 
    37 #include <libdodo/cgiBasicExchange.h> 
    3836 
    3937namespace dodo 
  • trunk/include/libdodo/cgiDialogue.h

    r1166 r1167  
    3333#include <libdodo/directives.h> 
    3434 
    35 #include <string.h> 
    36 #include <stdlib.h> 
     35#include <libdodo/types.h> 
    3736 
    3837#include <libdodo/cgi.h> 
    39 #include <libdodo/cgiDialogueEx.h> 
    40 #include <libdodo/toolsMisc.h> 
    41 #include <libdodo/toolsCode.h> 
    42 #include <libdodo/types.h> 
    43 #include <libdodo/toolsString.h> 
    4438#include <libdodo/cgiExchange.h> 
    45 #include <libdodo/ioStdio.h> 
    4639 
    4740namespace dodo 
  • trunk/include/libdodo/cgiExchange.h

    r1166 r1167  
    3333#include <libdodo/directives.h> 
    3434 
    35 #include <libdodo/types.h> 
    3635#include <libdodo/ioChannel.h> 
    3736 
  • trunk/include/libdodo/cgiFastExchange.h

    r1166 r1167  
    3535#ifdef FASTCGI_EXT 
    3636 
    37 #include <fcgiapp.h> 
    38  
     37#include <libdodo/cgiExchange.h> 
    3938#include <libdodo/types.h> 
    40 #include <libdodo/cgiFastExchangeEx.h> 
    41 #include <libdodo/cgiExchange.h> 
    42 #include <libdodo/ioChannel.h> 
    4339 
    4440namespace dodo 
     
    4844                namespace fast 
    4945                { 
     46                        /** 
     47                         * @struct __request 
     48                         * @brief defines fast CGI request interface 
     49                         */ 
     50                        struct __request; 
     51 
    5052                        /** 
    5153                         * @class exchange 
     
    6971                                 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    7072                                 */ 
    71                                 exchange(FCGX_Request *request, 
    72                                                  short        protection = io::CHANNEL_PROTECTION_PROCESS); 
     73                                exchange(const __request &req, 
     74                                                 short                  protection = io::CHANNEL_PROTECTION_PROCESS); 
    7375 
    7476                                /** 
     
    129131                          private: 
    130132 
    131                                 FCGX_Request *request; ///< fast CGI descriptor 
     133                                __request *request; ///< fast CGI descriptor 
    132134                        }; 
    133135                }; 
  • trunk/include/libdodo/cgiFastServer.h

    r1166 r1167  
    3535#ifdef FASTCGI_EXT 
    3636 
    37 #ifdef PTHREAD_EXT 
     37#include <libdodo/pcSyncThreadSection.h> 
    3838 
    39 #include <pthread.h> 
    40  
    41 #endif 
    42  
    43 #include <fcgiapp.h> 
    44  
     39#include <libdodo/cgiServer.h> 
    4540#include <libdodo/types.h> 
    46 #include <libdodo/cgiServer.h> 
    47 #include <libdodo/cgiFastServerEx.h> 
    48 #include <libdodo/cgiFastExchange.h> 
    49 #include <libdodo/ioChannel.h> 
    5041 
    5142namespace dodo 
     
    7162                          public: 
    7263 
    73 #ifdef PTHREAD_EXT 
    74  
    7564                                /** 
    7665                                 * constructor 
     
    8473                                           bool          threading = true, 
    8574                                           unsigned int  threadsNum = 10); 
    86  
    87 #else 
    88  
    89                                 /** 
    90                                  * constructor 
    91                                  * @param limit defines limit of incoming requests 
    92                                  * @note if limit is exhausted `listen` will return 
    93                                  * if limit is 0 `listen` never returns 
    94                                  */ 
    95                                 server(unsigned long limit = 0); 
    96  
    97 #endif 
    9875 
    9976                                /** 
     
    11592                          private: 
    11693 
    117 #ifdef PTHREAD_EXT 
    11894 
    11995                                bool threading;                     ///< true use threading 
     
    125101                                 * @param data defines the data that will be passed to the thread 
    126102                                 */ 
    127                                 static void *stackThread(void *data); 
     103                                static void *fastCGIThread(void *data); 
    128104 
    129                                 static pthread_mutex_t acceptM;     ///< accept request mutex 
    130                                 static pthread_mutex_t requestsM;   ///< request conter mutex 
    131  
    132 #endif 
     105                                static pc::sync::thread::section acceptLock; ///< accept request mutex 
     106                                static pc::sync::thread::section requestLock; ///< accept request mutex 
    133107 
    134108                                static serverHandler handler;       ///< function to be called on new request 
    135109 
    136                                 static unsigned long limit;         ///< limit of requests to serve; if 0 server forever[0 by default] 
    137                                 static unsigned long requests;      ///< counter of requests 
     110                                unsigned long limit;         ///< limit of requests to serve; if 0 server forever[0 by default] 
    138111                        }; 
    139112                }; 
  • trunk/include/libdodo/cgiServer.h

    r1160 r1167  
    3333#include <libdodo/directives.h> 
    3434 
    35 #include <libdodo/types.h> 
    3635#include <libdodo/cgiExchange.h> 
    3736 
  • trunk/include/libdodo/dataBaseAccumulator.h

    r1164 r1167  
    3434 
    3535#include <libdodo/types.h> 
    36 #include <libdodo/toolsMisc.h> 
    37 #include <libdodo/toolsString.h> 
     36#include <libdodo/xexec.h> 
    3837#include <libdodo/dataBaseConnector.h> 
    3938 
     
    4948                         */ 
    5049                        class __xexecDataBaseAccumulatorCollectedData 
    51  
    5250#ifndef DATABASE_WO_XEXEC 
    53  
    5451                                : public __xexecCollectedData 
    55  
    5652#endif 
    5753                        { 
  • trunk/include/libdodo/dataBaseMysql.h

    r1160 r1167  
    3535#ifdef MYSQL_EXT 
    3636 
    37 #include <mysql.h> 
    38 #include <errmsg.h> 
    39 #include <sys/socket.h> 
    40  
    41 #include <libdodo/toolsMisc.h> 
    42 #include <libdodo/dataBaseMysqlEx.h> 
     37#include <libdodo/types.h> 
    4338#include <libdodo/dataBaseSqlConstructor.h> 
    44 #include <libdodo/xexec.h> 
    4539 
    4640namespace dodo 
     
    5044                namespace base 
    5145                { 
     46                        /** 
     47                         * @struct __mysqlHandle 
     48                         * @brief defines internal handlers for MySQL DBMS interaction 
     49                         */ 
     50                        struct __mysqlHandle; 
     51 
    5252                        /** 
    5353                         * @struct __mysqlSslOptions 
     
    187187                                bool empty;             ///< true id mysqlRes is empty 
    188188 
    189                                 MYSQL *mysqlHandle;     ///< DB handle 
    190                                 MYSQL_RES *mysqlResult; ///< handle to result 
     189                                __mysqlHandle *handle; ///< DB handle 
    191190 
    192191                                unsigned long type;     ///< connection type 
  • trunk/include/libdodo/dataBasePostgresql.h

    r1160 r1167  
    3535#ifdef POSTGRESQL_EXT 
    3636 
    37 #include <libpq-fe.h> 
    38 #include <stdlib.h> 
    39  
    40 #include <libdodo/toolsMisc.h> 
    41 #include <libdodo/dataBasePostgresqlEx.h> 
     37#include <libdodo/types.h> 
    4238#include <libdodo/dataBaseSqlConstructor.h> 
    43 #include <libdodo/xexec.h> 
    4439 
    4540namespace dodo 
     
    4944                namespace base 
    5045                { 
     46                        /** 
     47                         * @struct __postgresqlHandle 
     48                         * @brief defines internal handlers for MySQL DBMS interaction 
     49                         */ 
     50                        struct __postgresqlHandle; 
     51 
    5152                        /** 
    5253                         * @class postgresql 
     
    239240                                bool empty;                                                                 ///< true id pgResult is empty 
    240241 
    241                                 PGconn *pgHandle;                                                           ///< DB handle 
    242                                 PGresult *pgResult;                                                         ///< handlde to result 
     242                                __postgresqlHandle *handle; ///< DB handle 
    243243                        }; 
    244244                }; 
  • trunk/include/libdodo/dataBaseSqlConstructor.h

    r1160 r1167  
    3333#include <libdodo/directives.h> 
    3434 
    35 #include <libdodo/toolsMisc.h> 
    36 #include <libdodo/dataBaseSqlConstructorEx.h> 
    3735#include <libdodo/types.h> 
    3836#include <libdodo/dataBaseAccumulator.h> 
  • trunk/include/libdodo/dataBaseSqlite.h

    r1160 r1167  
    3535#ifdef SQLITE3_EXT 
    3636 
    37 #include <sqlite3.h> 
    38  
    39 #include <libdodo/toolsMisc.h> 
    40 #include <libdodo/dataBaseSqliteEx.h> 
    4137#include <libdodo/dataBaseSqlConstructor.h> 
    42 #include <libdodo/xexec.h> 
    4338 
    4439namespace dodo 
     
    4843                namespace base 
    4944                { 
     45                        /** 
     46                         * @struct __mysqlHandle 
     47                         * @brief defines internal handlers for MySQL DBMS interaction 
     48                         */ 
     49                        struct __sqliteHandle; 
     50 
    5051                        /** 
    5152                         * @class sqlite 
     
    166167                          private: 
    167168 
    168                                 sqlite3 *sqliteHandle;          ///< DB handle 
    169                                 sqlite3_stmt *sqliteResult;     ///< handlde to result 
     169                                __sqliteHandle *handle; ///< DB handle 
    170170 
    171171                                bool empty;                     ///< true if liteStmt is empty 
  • trunk/src/cgi.cc

    r1160 r1167  
    2929 
    3030#include <libdodo/cgi.h> 
     31 
     32#include <libdodo/directives.h> 
     33 
     34#include <libdodo/types.h> 
    3135 
    3236using namespace dodo::cgi; 
  • trunk/src/cgiBasicExchange.cc

    r1166 r1167  
    3030#include <libdodo/cgiBasicExchange.h> 
    3131 
     32#include <libdodo/directives.h> 
     33 
     34#include <libdodo/cgiExchange.h> 
     35#include <libdodo/ioStdio.h> 
     36 
    3237using namespace dodo::cgi::basic; 
    3338 
     
    4348{ 
    4449#ifndef IO_WO_XEXEC 
    45  
    4650        collectedData.setExecObject(XEXEC_OBJECT_CGIBASICEXCHANGE); 
    47  
    4851#endif 
    4952} 
  • trunk/src/cgiBasicServer.cc

    r1162 r1167  
    3030#include <libdodo/cgiBasicServer.h> 
    3131 
     32#include <libdodo/directives.h> 
     33 
     34#include <libdodo/cgiBasicExchange.h> 
     35 
    3236using namespace dodo::cgi::basic; 
    3337 
  • trunk/src/cgiDialogue.cc

    r1166 r1167  
    2828 */ 
    2929 
     30#include <string.h> 
     31#include <stdlib.h> 
     32 
    3033#include <libdodo/cgiDialogue.h> 
     34 
     35#include <libdodo/directives.h> 
     36 
     37#include <libdodo/types.h> 
     38 
     39#include <libdodo/cgi.h> 
     40#include <libdodo/cgiExchange.h> 
     41#include <libdodo/cgiDialogueEx.h> 
     42 
    3143 
    3244using namespace dodo::cgi; 
  • trunk/src/cgiExchange.cc

    r1166 r1167  
    3030#include <libdodo/cgiExchange.h> 
    3131 
     32#include <libdodo/directives.h> 
     33 
     34#include <libdodo/ioChannel.h> 
     35 
    3236using namespace dodo::cgi; 
    3337 
  • trunk/src/cgiFastExchange.cc

    r1166 r1167  
    2828 */ 
    2929 
    30 #include <libdodo/cgiFastExchange.h> 
     30#include <libdodo/directives.h> 
    3131 
    3232#ifdef FASTCGI_EXT 
     33 
     34#include <fcgiapp.h> 
     35 
     36#include "cgiFastExchange.inline" 
     37 
     38#include <libdodo/cgiFastExchange.h> 
     39#include <libdodo/cgiFastExchangeEx.h> 
     40#include <libdodo/types.h> 
     41#include <libdodo/cgiExchange.h> 
     42#include <libdodo/ioChannel.h> 
    3343 
    3444using namespace dodo::cgi::fast; 
    3545 
    3646exchange::exchange(exchange &cf) : dodo::cgi::exchange(cf.protection), 
    37                                                                    channel(cf.protection) 
     47                                                                   channel(cf.protection), 
     48                                                                   request(new __request) 
    3849{ 
    3950} 
     
    4152//------------------------------------------------------------------- 
    4253 
    43 exchange::exchange(FCGX_Request *a_request, 
    44                                    short        protection) : request(a_request), 
    45                                                                                           dodo::cgi::exchange(protection), 
    46                                                                                           channel(protection) 
     54exchange::exchange(const __request &req, 
     55                                   short                   protection) : dodo::cgi::exchange(protection), 
     56                                                                                                 channel(protection) 
    4757{ 
     58        request->request = req.request; 
     59 
    4860#ifndef IO_WO_XEXEC 
    49  
    5061        collectedData.setExecObject(XEXEC_OBJECT_CGIFASTEXCHANGE); 
    51  
    5262#endif 
    5363} 
     
    5767exchange::~exchange() 
    5868{ 
     69        delete request; 
    5970} 
    6071 
     
    6475exchange::flush() 
    6576{ 
    66         if (FCGX_FFlush(request->out) == -1) 
     77        if (FCGX_FFlush(request->request->out) == -1) 
    6778        { 
    6879                throw exception::basic(exception::ERRMODULE_CGIFASTEXCHANGE, FASTEXCHANGEEX_FLUSH, exception::ERRNO_LIBDODO, FASTEXCHANGEEX_FAILEDTOFLUSH, CGIFASTEXCHANGEEX_FAILEDTOFLUSH_STR, __LINE__, __FILE__); 
     
    7586exchange::getenv(const char *buf) 
    7687{ 
    77         return FCGX_GetParam(buf, request->envp); 
     88        return FCGX_GetParam(buf, request->request->envp); 
    7889} 
    7990 
     
    101112        memset(a_data, '\0', inSize); 
    102113 
    103         FCGX_GetStr(a_data, inSize, request->in); 
     114        FCGX_GetStr(a_data, inSize, request->request->in); 
    104115} 
    105116 
     
    109120exchange::_write(const char *const buf) 
    110121{ 
    111         if (FCGX_PutStr(buf, outSize, request->out) == -1) 
     122        if (FCGX_PutStr(buf, outSize, request->request->out) == -1) 
    112123        { 
    113124                throw exception::basic(exception::ERRMODULE_CGIFASTEXCHANGE, FASTEXCHANGEEX__WRITE, exception::ERRNO_LIBDODO, FASTEXCHANGEEX_FAILEDTOPRINTSTRING, CGIFASTEXCHANGEEX_FAILEDTOPRINTSTRING_STR, __LINE__, __FILE__); 
  • trunk/src/cgiFastServer.cc

    r1162 r1167  
    2828 */ 
    2929 
     30#include <libdodo/directives.h> 
     31 
     32#ifdef FASTCGI_EXT 
     33 
     34#include <fcgiapp.h> 
     35 
     36#include "cgiFastExchange.inline" 
     37 
     38#include <libdodo/types.h> 
    3039#include <libdodo/cgiFastServer.h> 
    31  
    32 #ifdef FASTCGI_EXT 
     40#include <libdodo/cgiFastServerEx.h> 
     41#include <libdodo/cgiFastExchange.h> 
     42#include <libdodo/pcSyncThreadSection.h> 
     43#include <libdodo/pcSyncProtector.h> 
    3344 
    3445using namespace dodo::cgi::fast; 
    3546 
    36 #ifdef PTHREAD_EXT 
    37  
    38 pthread_mutex_t server::acceptM = PTHREAD_MUTEX_INITIALIZER; 
    39  
    40 //------------------------------------------------------------------- 
    41  
    42 pthread_mutex_t server::requestsM = PTHREAD_MUTEX_INITIALIZER; 
    43  
    44 #endif 
    45  
    46 //------------------------------------------------------------------- 
    47  
    48 unsigned long server::limit = 0; 
    49  
    50 //------------------------------------------------------------------- 
    51  
    52 unsigned long server::requests = -1; 
     47dodo::pc::sync::thread::section server::acceptLock; 
     48 
     49//------------------------------------------------------------------- 
     50 
     51dodo::pc::sync::thread::section server::requestLock; 
    5352 
    5453//------------------------------------------------------------------- 
    5554 
    5655void 
    57 dummyStackThread(dodo::cgi::exchange &data) 
    58 { 
    59 } 
    60  
    61 //------------------------------------------------------------------- 
    62  
    63 dodo::cgi::serverHandler server::handler = &dummyStackThread; 
     56dummyfastCGIThread(dodo::cgi::exchange &data) 
     57{ 
     58} 
     59 
     60//------------------------------------------------------------------- 
     61 
     62dodo::cgi::serverHandler server::handler = &dummyfastCGIThread; 
    6463 
    6564//------------------------------------------------------------------- 
     
    7069 
    7170//------------------------------------------------------------------- 
    72  
    73 #ifdef PTHREAD_EXT 
    7471 
    7572server::server(unsigned long a_limit, 
     
    8077        limit = a_limit; 
    8178 
    82         pthread_mutexattr_t attr; 
    83  
    84         pthread_mutexattr_init(&attr); 
    85         pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); 
    86  
    87         pthread_mutex_init(&acceptM, &attr); 
    88         pthread_mutex_init(&requestsM, &attr); 
    89  
    90         pthread_mutexattr_destroy(&attr); 
    91  
    9279        FCGX_Init(); 
    9380} 
     
    9582//------------------------------------------------------------------- 
    9683 
    97 #else 
    98  
    99 server::server(unsigned long a_limit) 
    100 { 
    101         limit = a_limit; 
    102  
    103         FCGX_Init(); 
    104 } 
    105  
    106 #endif 
    107  
    108 //------------------------------------------------------------------- 
    109  
    11084server::~server() 
    11185{ 
     
    11589//------------------------------------------------------------------- 
    11690 
    117 #ifdef PTHREAD_EXT 
    118  
    11991void * 
    120 server::stackThread(void *data) 
    121 { 
    122         FCGX_Request request; 
    123         FCGX_InitRequest(&request, 0, 0); 
    124  
    125         exchange cfSTD(&request); 
     92server::fastCGIThread(void *data) 
     93{ 
     94        FCGX_Request req; 
     95        __request request = {&req}; 
     96        FCGX_InitRequest(request.request, 0, 0); 
     97 
     98        exchange cfSTD(request); 
     99 
     100        unsigned long limit = *(unsigned long *)data; 
     101        unsigned long requests = 0; 
    126102 
    127103        int res = 0; 
     
    131107                if (limit != 0) 
    132108                { 
    133                         pthread_mutex_lock(&requestsM); 
     109                        pc::sync::protector rp(&requestLock); 
    134110 
    135111                        ++requests; 
     
    137113                        if (requests >= limit) 
    138114                        { 
    139                                 pthread_mutex_unlock(&requestsM); 
    140  
    141115                                break; 
    142116                        } 
    143  
    144                         pthread_mutex_lock(&requestsM); 
    145                 } 
    146  
    147                 pthread_mutex_lock(&acceptM); 
    148                 res = FCGX_Accept_r(&request); 
    149                 pthread_mutex_unlock(&acceptM); 
     117                } 
     118 
     119                acceptLock.acquire(); 
     120                res = FCGX_Accept_r(request.request); 
     121                acceptLock.release(); 
    150122 
    151123                if (res == -1) 
     
    156128                handler(cfSTD); 
    157129 
    158                 FCGX_Finish_r(&request); 
     130                FCGX_Finish_r(request.request); 
    159131        } 
    160132 
    161133        return NULL; 
    162134} 
    163  
    164 #endif 
    165135 
    166136//------------------------------------------------------------------- 
     
    176146        handler = func; 
    177147 
    178         requests = 0; 
    179  
    180 #ifdef PTHREAD_EXT 
    181148        if (threading) 
    182149        { 
     
    187154                for (; i < threadsNum; ++i) 
    188155                { 
    189                         pthread_create(&id[i], NULL, stackThread, NULL); 
     156                        pthread_create(&id[i], NULL, fastCGIThread, &limit); 
    190157                } 
    191158 
     
    198165        } 
    199166        else 
    200 #endif 
    201         { 
    202                 FCGX_Request request; 
    203                 FCGX_InitRequest(&request, 0, 0); 
    204  
    205                 exchange cfSTD(&request); 
     167        { 
     168                unsigned long requests = 0; 
     169 
     170                FCGX_Request req; 
     171                __request request = {&req}; 
     172                FCGX_InitRequest(request.request, 0, 0); 
     173 
     174                exchange cfSTD(request); 
    206175 
    207176                while (true) 
     
    217186                        } 
    218187 
    219                         if (FCGX_Accept_r(&request) == -1) 
     188                        if (FCGX_Accept_r(request.request) == -1) 
    220189                        { 
    221190                                throw exception::basic(exception::ERRMODULE_CGIFASTSERVER, SERVEREX_LISTEN, exception::ERRNO_LIBDODO, SERVEREX_ACCEPTFAILED, CGIFASTSERVEREX_ACCEPTFAILED_STR, __LINE__, __FILE__); 
     
    224193                        handler(cfSTD); 
    225194 
    226                         FCGX_Finish_r(&request); 
     195                        FCGX_Finish_r(request.request); 
    227196                } 
    228197        } 
  • trunk/src/dataBaseAccumulator.cc

    r1162 r1167  
    2828 */ 
    2929 
     30#include <libdodo/directives.h> 
     31 
     32#include <libdodo/types.h> 
    3033#include <libdodo/dataBaseAccumulator.h> 
     34#include <libdodo/toolsString.h> 
     35#include <libdodo/xexec.h> 
    3136 
    3237using namespace dodo::data::base; 
     
    4752                                                         , 
    4853                                                         collectedData(this, XEXEC_OBJECT_XEXEC) 
    49  
    5054#endif 
    5155{ 
  • trunk/src/dataBaseConnector.cc

    r1160 r1167  
    2828 */ 
    2929 
     30#include <libdodo/directives.h> 
     31 
     32#include <libdodo/types.h> 
    3033#include <libdodo/dataBaseConnector.h> 
    3134 
  • trunk/src/dataBaseMysql.cc

    r1162 r1167  
    2828 */ 
    2929 
     30#include <libdodo/directives.h> 
     31 
     32#ifdef MYSQL_EXT 
     33 
     34#include <mysql.h> 
     35 
     36namespace dodo 
     37{ 
     38        namespace data 
     39        { 
     40                namespace base 
     41                { 
     42                        struct __mysqlHandle 
     43                        { 
     44                                MYSQL     *handle; ///< DB handle 
     45                                MYSQL_RES *result; ///< handle to result 
     46                        }; 
     47                }; 
     48        }; 
     49}; 
     50 
     51#include <errmsg.h> 
     52 
    3053#include <libdodo/dataBaseMysql.h> 
    31  
    32 #ifdef MYSQL_EXT 
     54#include <libdodo/dataBaseMysqlEx.h> 
    3355 
    3456using namespace dodo::data::base; 
     
    3658mysql::mysql() : empty(true), 
    3759                                 type(CLIENT_MULTI_STATEMENTS), 
    38                                  mysqlHandle(NULL) 
    39  
    40 { 
    41 #ifndef DATABASE_WO_XEXEC 
    42  
     60                                 handle(new __mysqlHandle) 
     61 
     62{ 
     63#ifndef DATABASE_WO_XEXEC 
    4364        collectedData.setExecObject(XEXEC_OBJECT_DATABASEMYSQL); 
    44  
    45 #endif 
    46  
    47         mysqlHandle = mysql_init(NULL); 
     65#endif 
     66 
     67        handle->handle = mysql_init(NULL); 
    4868} 
    4969 
     
    5272mysql::mysql(const __connectionInfo &info) : empty(true), 
    5373                                                                                         type(CLIENT_MULTI_STATEMENTS), 
    54                                                                                          mysqlHandle(NULL) 
    55  
    56 { 
    57 #ifndef DATABASE_WO_XEXEC 
    58  
     74                                                                                         handle(new __mysqlHandle) 
     75 
     76{ 
     77#ifndef DATABASE_WO_XEXEC 
    5978        collectedData.setExecObject(XEXEC_OBJECT_DATABASEMYSQL); 
    60  
    6179#endif 
    6280 
    6381        collectedData.dbInfo = info; 
    6482 
    65         mysqlHandle = mysql_init(NULL); 
    66  
    67         if (!mysql_real_connect(mysqlHandle, 
     83        handle->handle = mysql_init(NULL); 
     84 
     85        if (!mysql_real_connect(handle->handle, 
    6886                                                        collectedData.dbInfo.host.size() == 0 ? NULL : collectedData.dbInfo.host.c_str(), 
    6987                                                        collectedData.dbInfo.user.size() == 0 ? NULL : collectedData.dbInfo.user.c_str(), 
     
    7492                                                        type)) 
    7593        { 
    76                 throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_MYSQL, exception::ERRNO_MYSQL, mysql_errno(mysqlHandle), mysql_error(mysqlHandle), __LINE__, __FILE__); 
     94                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_MYSQL, exception::ERRNO_MYSQL, mysql_errno(handle->handle), mysql_error(handle->handle), __LINE__, __FILE__); 
    7795        } 
    7896 
    7997#ifndef MYSQL_NO_OPT_RECONNECT 
    80  
    8198        if (reconnect) 
    8299        { 
    83100                my_bool rc = 1; 
    84101 
    85                 mysql_options(mysqlHandle, MYSQL_OPT_RECONNECT, &rc); 
    86         } 
    87  
     102                mysql_options(handle->handle, MYSQL_OPT_RECONNECT, &rc); 
     103        } 
    88104#endif 
    89105} 
     
    99115mysql::~mysql() 
    100116{ 
    101         if (mysqlHandle != NULL) 
     117        if (handle->handle != NULL) 
    102118        { 
    103119                if (!empty) 
    104120                { 
    105                         mysql_free_result(mysqlResult); 
    106                 } 
    107  
    108                 mysql_close(mysqlHandle); 
    109         } 
     121                        mysql_free_result(handle->result); 
     122                } 
     123 
     124                mysql_close(handle->handle); 
     125        } 
     126 
     127        delete handle; 
    110128} 
    111129 
     
    116134                                           const __mysqlSslOptions &options) 
    117135{ 
    118         if (mysqlHandle == NULL) 
     136        if (handle->handle == NULL) 
    119137        { 
    120138                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    123141        type = a_type; 
    124142 
    125         if (mysql_ssl_set(mysqlHandle, 
     143        if (mysql_ssl_set(handle->handle, 
    126144                                          options.key.size() == 0 ? NULL : options.key.c_str(), 
    127145                                          options.cert.size() == 0 ? NULL : options.cert.c_str(), 
     
    146164#endif 
    147165 
    148         if (mysqlHandle != NULL) 
     166        if (handle->handle != NULL) 
    149167        { 
    150168                if (!empty) 
    151169                { 
    152170                        empty = true; 
    153                         mysql_free_result(mysqlResult); 
    154                 } 
    155  
    156                 mysql_close(mysqlHandle); 
    157  
    158                 mysqlHandle = NULL; 
    159         } 
    160  
    161         mysqlHandle = mysql_init(NULL); 
    162  
    163         if (!mysql_real_connect(mysqlHandle, 
     171                        mysql_free_result(handle->result); 
     172                } 
     173 
     174                mysql_close(handle->handle); 
     175 
     176                handle->handle = NULL; 
     177        } 
     178 
     179        handle->handle = mysql_init(NULL); 
     180 
     181        if (!mysql_real_connect(handle->handle, 
    164182                                                        collectedData.dbInfo.host.size() == 0 ? NULL : collectedData.dbInfo.host.c_str(), 
    165183                                                        collectedData.dbInfo.user.size() == 0 ? NULL : collectedData.dbInfo.user.c_str(), 
     
    170188                                                        type)) 
    171189        { 
    172                 throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_CONNECT, exception::ERRNO_MYSQL, mysql_errno(mysqlHandle), mysql_error(mysqlHandle), __LINE__, __FILE__); 
     190                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_CONNECT, exception::ERRNO_MYSQL, mysql_errno(handle->handle), mysql_error(handle->handle), __LINE__, __FILE__); 
    173191        } 
    174192 
    175193#ifndef MYSQL_NO_OPT_RECONNECT 
    176  
    177194        if (reconnect) 
    178195        { 
    179196                my_bool rc = 1; 
    180197 
    181                 mysql_options(mysqlHandle, MYSQL_OPT_RECONNECT, &rc); 
    182         } 
    183  
     198                mysql_options(handle->handle, MYSQL_OPT_RECONNECT, &rc); 
     199        } 
    184200#endif 
    185201 
     
    194210mysql::disconnect() 
    195211{ 
    196         if (mysqlHandle != NULL) 
     212        if (handle->handle != NULL) 
    197213        { 
    198214#ifndef DATABASE_WO_XEXEC 
     
    204220                { 
    205221                        empty = true; 
    206                         mysql_free_result(mysqlResult); 
    207                 } 
    208  
    209                 mysql_close(mysqlHandle); 
     222                        mysql_free_result(handle->result); 
     223                } 
     224 
     225                mysql_close(handle->handle); 
    210226 
    211227#ifndef DATABASE_WO_XEXEC 
     
    213229#endif 
    214230 
    215                 mysqlHandle = NULL; 
     231                handle->handle = NULL; 
    216232        } 
    217233} 
     
    222238mysql::fetchRows() const 
    223239{ 
    224         if (mysqlHandle == NULL) 
     240        if (handle->handle == NULL) 
    225241        { 
    226242                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    239255        } 
    240256 
    241         mysql_data_seek(mysqlResult, 0); 
    242  
    243         unsigned int numFields = mysql_num_fields(mysqlResult); 
     257        mysql_data_seek(handle->result, 0); 
     258 
     259        unsigned int numFields = mysql_num_fields(handle->result); 
    244260 
    245261#ifndef USE_DEQUE 
    246         rows.reserve(mysql_num_rows(mysqlResult)); 
     262        rows.reserve(mysql_num_rows(handle->result)); 
    247263#endif 
    248264 
     
    257273#endif 
    258274 
    259         while ((mysqlRow = mysql_fetch_row(mysqlResult)) != NULL) 
    260         { 
    261                 length = mysql_fetch_lengths(mysqlResult); 
     275        while ((mysqlRow = mysql_fetch_row(handle->result)) != NULL) 
     276        { 
     277                length = mysql_fetch_lengths(handle->result); 
    262278 
    263279                rowsPart.clear(); 
     
    290306mysql::fetchFields() const 
    291307{ 
    292         if (mysqlHandle == NULL) 
     308        if (handle->handle == NULL) 
    293309        { 
    294310                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    307323        } 
    308324 
    309         mysql_field_seek(mysqlResult, 0); 
    310  
    311         unsigned int numFields = mysql_num_fields(mysqlResult); 
    312         MYSQL_FIELD *mysqlFields = mysql_fetch_fields(mysqlResult); 
     325        mysql_field_seek(handle->result, 0); 
     326 
     327        unsigned int numFields = mysql_num_fields(handle->result); 
     328        MYSQL_FIELD *mysqlFields = mysql_fetch_fields(handle->result); 
    313329 
    314330#ifndef USE_DEQUE 
     
    341357mysql::rowsCount() const 
    342358{ 
    343         if (mysqlHandle == NULL) 
     359        if (handle->handle == NULL) 
    344360        { 
    345361                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    352368        else 
    353369        { 
    354                 return mysql_num_rows(mysqlResult); 
     370                return mysql_num_rows(handle->result); 
    355371        } 
    356372} 
     
    361377mysql::fieldsCount() const 
    362378{ 
    363         if (mysqlHandle == NULL) 
     379        if (handle->handle == NULL) 
    364380        { 
    365381                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    372388        else 
    373389        { 
    374                 return mysql_num_fields(mysqlResult); 
     390                return mysql_num_fields(handle->result); 
    375391        } 
    376392} 
     
    381397mysql::affectedRowsCount() const 
    382398{ 
    383         if (mysqlHandle == NULL) 
     399        if (handle->handle == NULL) 
    384400        { 
    385401                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    392408        else 
    393409        { 
    394                 return mysql_affected_rows(mysqlHandle); 
     410                return mysql_affected_rows(handle->handle); 
    395411        } 
    396412} 
     
    401417mysql::getFieldsTypes(const dodoString &table) 
    402418{ 
    403         if (mysqlHandle == NULL) 
     419        if (handle->handle == NULL) 
    404420        { 
    405421                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    417433        request = "describe " + table; 
    418434 
    419         if (mysql_real_query(mysqlHandle, request.c_str(), request.size()) != 0) 
    420         { 
    421                 int mysqlErrno = mysql_errno(mysqlHandle); 
     435        if (mysql_real_query(handle->handle, request.c_str(), request.size()) != 0) 
     436        { 
     437                int mysqlErrno = mysql_errno(handle->handle); 
    422438                if (reconnect && (mysqlErrno == CR_SERVER_GONE_ERROR || mysqlErrno == CR_SERVER_LOST)) 
    423439                { 
    424440                        connect(collectedData.dbInfo); 
    425                         if (mysql_real_query(mysqlHandle, request.c_str(), request.size()) != 0) 
    426                         { 
    427                                 throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, mysqlErrno, mysql_error(mysqlHandle), __LINE__, __FILE__, request); 
     441                        if (mysql_real_query(handle->handle, request.c_str(), request.size()) != 0) 
     442                        { 
     443                                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, mysqlErrno, mysql_error(handle->handle), __LINE__, __FILE__, request); 
    428444                        } 
    429445                } 
    430446                else 
    431447                { 
    432                         throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, mysqlErrno, mysql_error(mysqlHandle), __LINE__, __FILE__, request); 
    433                 } 
    434         } 
    435  
    436         mysqlResult = mysql_store_result(mysqlHandle); 
    437         if (mysqlResult == NULL) 
    438         { 
    439                 throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, mysql_errno(mysqlHandle), mysql_error(mysqlHandle), __LINE__, __FILE__); 
     448                        throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, mysqlErrno, mysql_error(handle->handle), __LINE__, __FILE__, request); 
     449                } 
     450        } 
     451 
     452        handle->result = mysql_store_result(handle->handle); 
     453        if (handle->result == NULL) 
     454        { 
     455                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, mysql_errno(handle->handle), mysql_error(handle->handle), __LINE__, __FILE__); 
    440456        } 
    441457 
     
    446462        dodoMap<dodoString, short, dodoMapICaseStringCompare>::iterator field, fieldsEnd = types->second.end(); 
    447463 
    448         while ((mysqlRow = mysql_fetch_row(mysqlResult)) != NULL) 
     464        while ((mysqlRow = mysql_fetch_row(handle->result)) != NULL) 
    449465        { 
    450466                field = types->second.find(mysqlRow[0]); 
     
    498514        } 
    499515 
    500         mysql_free_result(mysqlResult); 
     516        mysql_free_result(handle->result); 
    501517 
    502518        empty = true; 
     
    509525                        bool             result) 
    510526{ 
    511         if (mysqlHandle == NULL) 
     527        if (handle->handle == NULL) 
    512528        { 
    513529                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    529545        } 
    530546 
    531         if (mysql_real_query(mysqlHandle, request.c_str(), request.size()) != 0) 
    532         { 
    533                 int mysqlErrno = mysql_errno(mysqlHandle); 
     547        if (mysql_real_query(handle->handle, request.c_str(), request.size()) != 0) 
     548        { 
     549                int mysqlErrno = mysql_errno(handle->handle); 
    534550                if (reconnect && (mysqlErrno == CR_SERVER_GONE_ERROR || mysqlErrno == CR_SERVER_LOST)) 
    535551                { 
    536552                        connect(collectedData.dbInfo); 
    537                         if (mysql_real_query(mysqlHandle, request.c_str(), request.size()) != 0) 
    538                         { 
    539                                 throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_EXEC, exception::ERRNO_MYSQL, mysqlErrno, mysql_error(mysqlHandle), __LINE__, __FILE__, request); 
     553                        if (mysql_real_query(handle->handle, request.c_str(), request.size()) != 0) 
     554                        { 
     555                                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_EXEC, exception::ERRNO_MYSQL, mysqlErrno, mysql_error(handle->handle), __LINE__, __FILE__, request); 
    540556                        } 
    541557                } 
    542558                else 
    543559                { 
    544                         throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_EXEC, exception::ERRNO_MYSQL, mysqlErrno, mysql_error(mysqlHandle), __LINE__, __FILE__, request); 
     560                        throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_EXEC, exception::ERRNO_MYSQL, mysqlErrno, mysql_error(handle->handle), __LINE__, __FILE__, request); 
    545561                } 
    546562        } 
     
    550566                if (!empty) 
    551567                { 
    552                         mysql_free_result(mysqlResult); 
     568                        mysql_free_result(handle->result); 
    553569                        empty = true; 
    554570                } 
    555571 
    556                 mysqlResult = mysql_store_result(mysqlHandle); 
    557                 if (mysqlResult == NULL) 
    558                 { 
    559                         throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_EXEC, exception::ERRNO_MYSQL, mysql_errno(mysqlHandle), mysql_error(mysqlHandle), __LINE__, __FILE__); 
     572                handle->result = mysql_store_result(handle->handle); 
     573                if (handle->result == NULL) 
     574                { 
     575                        throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_EXEC, exception::ERRNO_MYSQL, mysql_errno(handle->handle), mysql_error(handle->handle), __LINE__, __FILE__); 
    560576                } 
    561577 
     
    576592mysql::setCharset(const dodoString &charset) 
    577593{ 
    578         if (mysqlHandle == NULL) 
    579         { 
    580                 throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
    581         } 
    582  
    583         mysql_options(mysqlHandle, MYSQL_SET_CHARSET_NAME, charset.c_str()); 
     594        if (handle->handle == NULL) 
     595        { 
     596                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     597        } 
     598 
     599        mysql_options(handle->handle, MYSQL_SET_CHARSET_NAME, charset.c_str()); 
    584600} 
    585601 
     
    589605mysql::setConnectTimeout(unsigned int time) 
    590606{ 
    591         if (mysqlHandle == NULL) 
    592         { 
    593                 throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
    594         } 
    595  
    596         mysql_options(mysqlHandle, MYSQL_OPT_CONNECT_TIMEOUT, (char *)&time); 
     607        if (handle->handle == NULL) 
     608        { 
     609                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     610        } 
     611 
     612        mysql_options(handle->handle, MYSQL_OPT_CONNECT_TIMEOUT, (char *)&time); 
    597613} 
    598614 
     
    602618mysql::getCharset() const 
    603619{ 
    604         if (mysqlHandle == NULL) 
    605         { 
    606                 throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
    607         } 
    608  
    609         return mysql_character_set_name(mysqlHandle); 
     620        if (handle->handle == NULL) 
     621        { 
     622                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     623        } 
     624 
     625        return mysql_character_set_name(handle->handle); 
    610626} 
    611627 
     
    615631mysql::fetchFieldsToRows() const 
    616632{ 
    617         if (mysqlHandle == NULL) 
     633        if (handle->handle == NULL) 
    618634        { 
    619635                throw exception::basic(exception::ERRMODULE_DATABASEMYSQL, MYSQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, MYSQLEX_NOTOPENED, DATABASEMYSQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    627643        } 
    628644 
    629         mysql_data_seek(mysqlResult, 0); 
    630         mysql_field_seek(mysqlResult, 0); 
    631  
    632         unsigned int numFields = mysql_num_fields(mysqlResult); 
    633         MYSQL_FIELD *mysqlFields = mysql_fetch_fields(mysqlResult); 
     645        mysql_data_seek(handle->result, 0); 
     646        mysql_field_seek(handle->result, 0); 
     647 
     648        unsigned int numFields = mysql_num_fields(handle->result); 
     649        MYSQL_FIELD *mysqlFields = mysql_fetch_fields(handle->result); 
    634650 
    635651#ifndef USE_DEQUE 
    636         rowsFields.reserve(mysql_num_rows(mysqlResult)); 
     652        rowsFields.reserve(mysql_num_rows(handle->result)); 
    637653#endif 
    638654 
     
    644660        MYSQL_ROW mysqlRow; 
    645661 
    646         while ((mysqlRow = mysql_fetch_row(mysqlResult)) != NULL) 
    647         { 
    648                 length = mysql_fetch_lengths(mysqlResult); 
     662        while ((mysqlRow = mysql_fetch_row(handle->result)) != NULL) 
     663        { 
     664                length = mysql_fetch_lengths(handle->result); 
    649665 
    650666                for (j = 0; j < numFields; ++j) 
  • trunk/src/dataBasePostgresql.cc

    r1166 r1167  
    2828 */ 
    2929 
     30#include <libdodo/directives.h> 
     31 
     32#ifdef POSTGRESQL_EXT 
     33 
     34#include <libpq-fe.h> 
     35#include <stdlib.h> 
     36 
     37namespace dodo 
     38{ 
     39        namespace data 
     40        { 
     41                namespace base 
     42                { 
     43                        struct __postgresqlHandle 
     44                        { 
     45 
     46                                PGconn *handle; ///< DB handle 
     47                                PGresult *result; ///< handlde to result 
     48                        }; 
     49                }; 
     50        }; 
     51}; 
     52 
     53#include <libdodo/toolsString.h> 
     54#include <libdodo/toolsMisc.h> 
    3055#include <libdodo/dataBasePostgresql.h> 
    31  
    32 #ifdef POSTGRESQL_EXT 
     56#include <libdodo/dataBasePostgresqlEx.h> 
     57#include <libdodo/xexec.h> 
    3358 
    3459using namespace dodo::data::base; 
     
    84109 
    85110postgresql::postgresql() : empty(true), 
    86                                                    pgHandle(NULL) 
    87 { 
    88 #ifndef DATABASE_WO_XEXEC 
    89  
     111                                                   handle(new __postgresqlHandle) 
     112{ 
     113        handle->handle = NULL; 
     114 
     115#ifndef DATABASE_WO_XEXEC 
    90116        collectedData.setExecObject(XEXEC_OBJECT_DATABASEPOSTGRESQL); 
    91  
    92117#endif 
    93118} 
     
    96121 
    97122postgresql::postgresql(const __connectionInfo &info) : empty(true), 
    98                                                                                                            pgHandle(NULL) 
    99 { 
    100 #ifndef DATABASE_WO_XEXEC 
    101  
     123                                                                                                           handle(new __postgresqlHandle) 
     124{ 
     125#ifndef DATABASE_WO_XEXEC 
    102126        collectedData.setExecObject(XEXEC_OBJECT_DATABASEPOSTGRESQL); 
    103  
    104127#endif 
    105128 
    106129        collectedData.dbInfo = info; 
    107130 
    108         pgHandle = PQsetdbLogin( 
     131        handle->handle = PQsetdbLogin( 
    109132                collectedData.dbInfo.host.size() == 0 ? NULL : collectedData.dbInfo.host.c_str(), 
    110133                tools::string::uiToString(collectedData.dbInfo.port).c_str(), 
     
    115138                collectedData.dbInfo.password.size() == 0 ? NULL : collectedData.dbInfo.password.c_str()); 
    116139 
    117         int status = PQstatus(pgHandle); 
     140        int status = PQstatus(handle->handle); 
    118141 
    119142        if (status != CONNECTION_OK) 
    120143        { 
    121                 throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_POSTGRESQL, exception::ERRNO_MYSQL, status, PQerrorMessage(pgHandle), __LINE__, __FILE__); 
     144                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_POSTGRESQL, exception::ERRNO_MYSQL, status, PQerrorMessage(handle->handle), __LINE__, __FILE__); 
    122145        } 
    123146} 
     
    133156postgresql::~postgresql() 
    134157{ 
    135         if (pgHandle != NULL) 
     158        if (handle->handle != NULL) 
    136159        { 
    137160                if (!empty) 
    138161                { 
    139                         PQclear(pgResult); 
     162                        PQclear(handle->result); 
    140163                } 
    141164 
    142                 PQfinish(pgHandle); 
    143         } 
     165                PQfinish(handle->handle); 
     166        } 
     167 
     168        delete handle; 
    144169} 
    145170 
     
    156181#endif 
    157182 
    158         if (pgHandle != NULL) 
     183        if (handle->handle != NULL) 
    159184        { 
    160185                if (!empty) 
    161186                { 
    162                         PQclear(pgResult); 
     187                        PQclear(handle->result); 
    163188                        empty = true; 
    164189                } 
    165190 
    166                 PQfinish(pgHandle); 
    167  
    168                 pgHandle = NULL; 
    169         } 
    170  
    171         pgHandle = PQsetdbLogin( 
     191                PQfinish(handle->handle); 
     192 
     193                handle->handle = NULL; 
     194        } 
     195 
     196        handle->handle = PQsetdbLogin( 
    172197                collectedData.dbInfo.host.size() == 0 ? NULL : collectedData.dbInfo.host.c_str(), 
    173198                tools::string::uiToString(collectedData.dbInfo.port).c_str(), 
     
    178203                collectedData.dbInfo.password.size() == 0 ? NULL : collectedData.dbInfo.password.c_str()); 
    179204 
    180         int status = PQstatus(pgHandle); 
     205        int status = PQstatus(handle->handle); 
    181206 
    182207        if (status != CONNECTION_OK) 
    183208        { 
    184                 pgHandle = NULL; 
    185  
    186                 throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_CONNECT, exception::ERRNO_MYSQL, status, PQerrorMessage(pgHandle), __LINE__, __FILE__); 
     209                handle->handle = NULL; 
     210 
     211                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_CONNECT, exception::ERRNO_MYSQL, status, PQerrorMessage(handle->handle), __LINE__, __FILE__); 
    187212        } 
    188213 
     
    197222postgresql::disconnect() 
    198223{ 
    199         if (pgHandle != NULL) 
     224        if (handle->handle != NULL) 
    200225        { 
    201226#ifndef DATABASE_WO_XEXEC 
     
    206231                if (!empty) 
    207232                { 
    208                         PQclear(pgResult); 
     233                        PQclear(handle->result); 
    209234                        empty = true; 
    210235                } 
    211236 
    212                 PQfinish(pgHandle); 
     237                PQfinish(handle->handle); 
    213238 
    214239#ifndef DATABASE_WO_XEXEC 
     
    216241#endif 
    217242 
    218                 pgHandle = NULL; 
     243                handle->handle = NULL; 
    219244        } 
    220245} 
     
    225250postgresql::fetchRows() const 
    226251{ 
    227         if (pgHandle == NULL) 
     252        if (handle->handle == NULL) 
    228253        { 
    229254                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, POSTGRESQLEX_NOTOPENED, DATABASEPOSTGRESQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    242267        } 
    243268 
    244         int rowsNum = PQntuples(pgResult); 
    245         int fieldsNum = PQnfields(pgResult); 
     269        int rowsNum = PQntuples(handle->result); 
     270        int fieldsNum = PQnfields(handle->result); 
    246271 
    247272#ifndef USE_DEQUE 
     
    262287                for (j = 0; j < fieldsNum; ++j) 
    263288                { 
    264                         if (PQgetisnull(pgResult, i, j) == 1) 
     289                        if (PQgetisnull(handle->result, i, j) == 1) 
    265290                        { 
    266291                                rowsPart.push_back(statements[SQLCONSTRUCTOR_STATEMENT_NULL]); 
     
    268293                        else 
    269294                        { 
    270                                 rowsPart.push_back(dodoString(PQgetvalue(pgResult, i, j), PQgetlength(pgResult, i, j))); 
     295                                rowsPart.push_back(dodoString(PQgetvalue(handle->result, i, j), PQgetlength(handle->result, i, j))); 
    271296                        } 
    272297                } 
     
    287312postgresql::fetchFields() const 
    288313{ 
    289         if (pgHandle == NULL) 
     314        if (handle->handle == NULL) 
    290315        { 
    291316                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, POSTGRESQLEX_NOTOPENED, DATABASEPOSTGRESQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    304329        } 
    305330 
    306         int fieldsNum = PQnfields(pgResult); 
     331        int fieldsNum = PQnfields(handle->result); 
    307332 
    308333#ifndef USE_DEQUE 
     
    312337        for (int i(0); i < fieldsNum; ++i) 
    313338        { 
    314                 fields.push_back(PQfname(pgResult, i)); 
     339                fields.push_back(PQfname(handle->result, i)); 
    315340        } 
    316341 
     
    335360postgresql::rowsCount() const 
    336361{ 
    337         if (pgHandle == NULL) 
     362        if (handle->handle == NULL) 
    338363        { 
    339364                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, POSTGRESQLEX_NOTOPENED, DATABASEPOSTGRESQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    346371        else 
    347372        { 
    348                 return PQntuples(pgResult); 
     373                return PQntuples(handle->result); 
    349374        } 
    350375} 
     
    355380postgresql::fieldsCount() const 
    356381{ 
    357         if (pgHandle == NULL) 
     382        if (handle->handle == NULL) 
    358383        { 
    359384                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, POSTGRESQLEX_NOTOPENED, DATABASEPOSTGRESQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    366391        else 
    367392        { 
    368                 return PQnfields(pgResult); 
     393                return PQnfields(handle->result); 
    369394        } 
    370395} 
     
    375400postgresql::affectedRowsCount() const 
    376401{ 
    377         if (pgHandle == NULL) 
     402        if (handle->handle == NULL) 
    378403        { 
    379404                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, POSTGRESQLEX_NOTOPENED, DATABASEPOSTGRESQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    386411        else 
    387412        { 
    388                 return atoi(PQcmdTuples(pgResult)); 
     413                return atoi(PQcmdTuples(handle->result)); 
    389414        } 
    390415} 
     
    395420postgresql::getFieldsTypes(const dodoString &table) 
    396421{ 
    397         if (pgHandle == NULL) 
     422        if (handle->handle == NULL) 
    398423        { 
    399424                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, POSTGRESQLEX_NOTOPENED, DATABASEPOSTGRESQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    413438        if (!empty) 
    414439        { 
    415                 PQclear(pgResult); 
     440                PQclear(handle->result); 
    416441                empty = true; 
    417442        } 
    418443 
    419         pgResult = PQexecParams(pgHandle, request.c_str(), 0, NULL, NULL, NULL, NULL, 1); 
    420         if (pgResult == NULL) 
    421         { 
    422                 throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, PGRES_FATAL_ERROR, PQerrorMessage(pgHandle), __LINE__, __FILE__, request); 
    423         } 
    424  
    425         int status = PQresultStatus(pgResult); 
     444        handle->result = PQexecParams(handle->handle, request.c_str(), 0, NULL, NULL, NULL, NULL, 1); 
     445        if (handle->result == NULL) 
     446        { 
     447                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, PGRES_FATAL_ERROR, PQerrorMessage(handle->handle), __LINE__, __FILE__, request); 
     448        } 
     449 
     450        int status = PQresultStatus(handle->result); 
    426451 
    427452        switch (status) 
     
    432457                case PGRES_FATAL_ERROR: 
    433458 
    434                         throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, status, PQerrorMessage(pgHandle), __LINE__, __FILE__); 
     459                        throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, status, PQerrorMessage(handle->handle), __LINE__, __FILE__); 
    435460        } 
    436461 
    437462        empty = false; 
    438463 
    439         int rowsNum = PQntuples(pgResult); 
     464        int rowsNum = PQntuples(handle->result); 
    440465 
    441466        const char *columnType, *columnName; 
     
    447472        for (int i(0); i < rowsNum; ++i) 
    448473        { 
    449                 columnName = PQgetvalue(pgResult, i, 0); 
    450                 columnType = PQgetvalue(pgResult, i, 1); 
     474                columnName = PQgetvalue(handle->result, i, 0); 
     475                columnType = PQgetvalue(handle->result, i, 1); 
    451476 
    452477                field = types->second.find(columnName); 
     
    504529        if (!empty) 
    505530        { 
    506                 PQclear(pgResult); 
     531                PQclear(handle->result); 
    507532                empty = true; 
    508533        } 
     
    515540                                 bool             result) 
    516541{ 
    517         if (pgHandle == NULL) 
     542        if (handle->handle == NULL) 
    518543        { 
    519544                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, POSTGRESQLEX_NOTOPENED, DATABASEPOSTGRESQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    539564        if (!empty) 
    540565        { 
    541                 PQclear(pgResult); 
     566                PQclear(handle->result); 
    542567                empty = true; 
    543568        } 
     
    559584                } 
    560585 
    561                 pgResult = PQexecParams(pgHandle, request.c_str(), size, NULL, values, lengths, formats, 0); 
     586                handle->result = PQexecParams(handle->handle, request.c_str(), size, NULL, values, lengths, formats, 0); 
    562587 
    563588                blobs.clear(); 
     
    565590        else 
    566591        { 
    567                 pgResult = PQexecParams(pgHandle, request.c_str(), 0, NULL, NULL, NULL, NULL, 1); 
    568         } 
    569  
    570         if (pgResult == NULL) 
    571         { 
    572                 throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_EXEC, exception::ERRNO_MYSQL, PGRES_FATAL_ERROR, PQerrorMessage(pgHandle), __LINE__, __FILE__); 
    573         } 
    574  
    575         status = PQresultStatus(pgResult); 
     592                handle->result = PQexecParams(handle->handle, request.c_str(), 0, NULL, NULL, NULL, NULL, 1); 
     593        } 
     594 
     595        if (handle->result == NULL) 
     596        { 
     597                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_EXEC, exception::ERRNO_MYSQL, PGRES_FATAL_ERROR, PQerrorMessage(handle->handle), __LINE__, __FILE__); 
     598        } 
     599 
     600        status = PQresultStatus(handle->result); 
    576601        switch (status) 
    577602        { 
     
    581606                case PGRES_FATAL_ERROR: 
    582607 
    583                         throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_EXEC, exception::ERRNO_MYSQL, status, PQerrorMessage(pgHandle), __LINE__, __FILE__); 
     608                        throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_EXEC, exception::ERRNO_MYSQL, status, PQerrorMessage(handle->handle), __LINE__, __FILE__); 
    584609        } 
    585610 
     
    926951        } 
    927952 
    928         int rowsNum = PQntuples(pgResult); 
    929         int fieldsNum = PQnfields(pgResult); 
     953        int rowsNum = PQntuples(handle->result); 
     954        int fieldsNum = PQnfields(handle->result); 
    930955 
    931956#ifndef USE_DEQUE 
     
    942967                for (j = 0; j < fieldsNum; ++j) 
    943968                { 
    944                         if (PQgetisnull(pgResult, i, j) == 1) 
    945                         { 
    946                                 rowFieldsPart.insert(make_pair(PQfname(pgResult, j), statements[SQLCONSTRUCTOR_STATEMENT_NULL])); 
     969                        if (PQgetisnull(handle->result, i, j) == 1) 
     970                        { 
     971                                rowFieldsPart.insert(make_pair(PQfname(handle->result, j), statements[SQLCONSTRUCTOR_STATEMENT_NULL])); 
    947972                        } 
    948973                        else 
    949974                        { 
    950                                 rowFieldsPart.insert(make_pair(PQfname(pgResult, j), dodoString(PQgetvalue(pgResult, i, j), PQgetlength(pgResult, i, j)))); 
     975                                rowFieldsPart.insert(make_pair(PQfname(handle->result, j), dodoString(PQgetvalue(handle->result, i, j), PQgetlength(handle->result, i, j)))); 
    951976                        } 
    952977                } 
     
    963988postgresql::setCharset(const dodoString &charset) 
    964989{ 
    965         if (pgHandle == NULL) 
     990        if (handle->handle == NULL) 
    966991        { 
    967992                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, POSTGRESQLEX_NOTOPENED, DATABASEPOSTGRESQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
    968993        } 
    969994 
    970         int status = PQsetClientEncoding(pgHandle, charset.c_str()); 
     995        int status = PQsetClientEncoding(handle->handle, charset.c_str()); 
    971996        if (status == -1) 
    972997        { 
    973                 throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_SETCHARSET, exception::ERRNO_MYSQL, status, PQerrorMessage(pgHandle), __LINE__, __FILE__); 
     998                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_SETCHARSET, exception::ERRNO_MYSQL, status, PQerrorMessage(handle->handle), __LINE__, __FILE__); 
    974999        } 
    9751000} 
     
    9801005postgresql::getCharset() const 
    9811006{ 
    982         if (pgHandle == NULL) 
     1007        if (handle->handle == NULL) 
    9831008        { 
    9841009                throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, POSTGRESQLEX_NOTOPENED, DATABASEPOSTGRESQLEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    9861011 
    9871012#ifdef POSTGRESQL_NO_ENCODINGTOCHAR 
    988  
    989         int encoding = PQclientEncoding(pgHandle); 
     1013        int encoding = PQclientEncoding(handle->handle); 
    9901014 
    9911015        if (encoding >= 0 && encoding < _PG_LAST_ENCODING_) 
     
    9951019 
    9961020        return __dodostring__; 
    997  
    9981021#else 
    999  
    1000         return pg_encoding_to_char(PQclientEncoding(pgHandle)); 
    1001  
    1002 #endif 
    1003 } 
    1004  
    1005 #endif 
    1006  
    1007 //------------------------------------------------------------------- 
     1022        return pg_encoding_to_char(PQclientEncoding(handle->handle)); 
     1023#endif 
     1024} 
     1025 
     1026#endif 
     1027 
     1028//------------------------------------------------------------------- 
  • trunk/src/dataBaseSqlConstructor.cc

    r1166 r1167  
    2828 */ 
    2929 
     30#include <libdodo/directives.h> 
     31 
     32#include <libdodo/types.h> 
     33#include <libdodo/toolsMisc.h> 
    3034#include <libdodo/dataBaseSqlConstructor.h> 
     35#include <libdodo/dataBaseSqlConstructorEx.h> 
     36#include <libdodo/dataBaseAccumulator.h> 
    3137 
    3238using namespace dodo::data::base::sql; 
  • trunk/src/dataBaseSqlite.cc

    r1166 r1167  
    2828 */ 
    2929 
     30#include <libdodo/directives.h> 
     31 
     32#ifdef SQLITE3_EXT 
     33 
     34#include <sqlite3.h> 
     35 
     36namespace dodo 
     37{ 
     38        namespace data 
     39        { 
     40                namespace base 
     41                { 
     42                        struct __sqliteHandle 
     43                        { 
     44                                sqlite3 *handle; ///< DB handle 
     45                                sqlite3_stmt *result; ///< handlde to result 
     46                        }; 
     47                }; 
     48        }; 
     49}; 
     50 
    3051#include <libdodo/dataBaseSqlite.h> 
    31  
    32 #ifdef SQLITE3_EXT 
     52#include <libdodo/toolsMisc.h> 
     53#include <libdodo/dataBaseSqliteEx.h> 
     54#include <libdodo/xexec.h> 
    3355 
    3456using namespace dodo::data::base; 
    3557 
    3658sqlite::sqlite() : empty(true), 
    37                                    sqliteHandle(NULL) 
    38 { 
     59                                   handle(new __sqliteHandle) 
     60{ 
     61        handle->handle = NULL; 
     62 
    3963#ifndef DATABASE_WO_XEXEC 
    40  
    4164        collectedData.setExecObject(XEXEC_OBJECT_DATABASESQLITE); 
    42  
    4365#endif 
    4466} 
     
    4769 
    4870sqlite::sqlite(const __connectionInfo &info) : empty(true), 
    49                                                                                            sqliteHandle(NULL) 
    50 { 
     71                                                                                           handle(new __sqliteHandle) 
     72{ 
     73        handle->handle = NULL; 
     74 
    5175#ifndef DATABASE_WO_XEXEC 
    52  
    5376        collectedData.setExecObject(XEXEC_OBJECT_DATABASESQLITE); 
    54  
    5577#endif 
    5678 
    5779        collectedData.dbInfo = info; 
    5880 
    59         if (sqlite3_open(collectedData.dbInfo.path.c_str(), &sqliteHandle) != SQLITE_OK) 
    60         { 
    61                 sqlite3_close(sqliteHandle); 
    62  
    63                 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_SQLITE, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     81        if (sqlite3_open(collectedData.dbInfo.path.c_str(), &handle->handle) != SQLITE_OK) 
     82        { 
     83                sqlite3_close(handle->handle); 
     84 
     85                delete handle; 
     86 
     87                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_SQLITE, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__); 
    6488        } 
    6589} 
     
    7599sqlite::~sqlite() 
    76100{ 
    77         if (sqliteHandle != NULL) 
     101        if (handle->handle != NULL) 
    78102        { 
    79103                if (!empty) 
    80104                { 
    81                         sqlite3_finalize(sqliteResult); 
    82                 } 
    83  
    84                 sqlite3_close(sqliteHandle); 
    85         } 
     105                        sqlite3_finalize(handle->result); 
     106                } 
     107 
     108                sqlite3_close(handle->handle); 
     109        } 
     110 
     111        delete handle; 
    86112} 
    87113 
     
    98124#endif 
    99125 
    100         if (sqliteHandle != NULL) 
     126        if (handle->handle != NULL) 
    101127        { 
    102128                if (!empty) 
    103129                { 
    104130                        empty = true; 
    105                         sqlite3_finalize(sqliteResult); 
    106                 } 
    107  
    108                 if (sqlite3_close(sqliteHandle) != SQLITE_OK) 
    109                 { 
    110                         throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_CONNECT, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
    111                 } 
    112  
    113                 sqliteHandle = NULL; 
    114         } 
    115  
    116         if (sqlite3_open(collectedData.dbInfo.path.c_str(), &sqliteHandle) != SQLITE_OK) 
    117         { 
    118                 sqlite3_close(sqliteHandle); 
    119  
    120                 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_CONNECT, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     131                        sqlite3_finalize(handle->result); 
     132                } 
     133 
     134                if (sqlite3_close(handle->handle) != SQLITE_OK) 
     135                { 
     136                        throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_CONNECT, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__); 
     137                } 
     138 
     139                handle->handle = NULL; 
     140        } 
     141 
     142        if (sqlite3_open(collectedData.dbInfo.path.c_str(), &handle->handle) != SQLITE_OK) 
     143        { 
     144                sqlite3_close(handle->handle); 
     145 
     146                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_CONNECT, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__); 
    121147        } 
    122148 
     
    131157sqlite::disconnect() 
    132158{ 
    133         if (sqliteHandle != NULL) 
     159        if (handle->handle != NULL) 
    134160        { 
    135161#ifndef DATABASE_WO_XEXEC 
     
    141167                { 
    142168                        empty = true; 
    143                         sqlite3_finalize(sqliteResult); 
    144                 } 
    145  
    146                 if (sqlite3_close(sqliteHandle) != SQLITE_OK) 
    147                 { 
    148                         throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_DISCONNECT, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     169                        sqlite3_finalize(handle->result); 
     170                } 
     171 
     172                if (sqlite3_close(handle->handle) != SQLITE_OK) 
     173                { 
     174                        throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_DISCONNECT, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__); 
    149175                } 
    150176 
     
    153179#endif 
    154180 
    155                 sqliteHandle = NULL; 
     181                handle->handle = NULL; 
    156182        } 
    157183} 
     
    162188sqlite::fetchRows() const 
    163189{ 
    164         if (sqliteHandle == NULL) 
     190        if (handle->handle == NULL) 
    165191        { 
    166192                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, SQLITEEX_NOTOPENED, DATABASESQLITEEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    179205        } 
    180206 
    181         sqlite3_reset(sqliteResult); 
    182  
    183         unsigned int numFields = sqlite3_column_count(sqliteResult); 
     207        sqlite3_reset(handle->result); 
     208 
     209        unsigned int numFields = sqlite3_column_count(handle->result); 
    184210 
    185211        bool iterate = true; 
     
    187213 
    188214#ifndef USE_DEQUE 
    189         rows.reserve(sqlite3_data_count(sqliteResult)); 
     215        rows.reserve(sqlite3_data_count(handle->result)); 
    190216#endif 
    191217 
     
    194220        while (iterate) 
    195221        { 
    196                 switch (sqlite3_step(sqliteResult)) 
     222                switch (sqlite3_step(handle->result)) 
    197223                { 
    198224                        case SQLITE_BUSY: 
     
    208234                        case SQLITE_ERROR: 
    209235 
    210                                 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     236                                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHROWS, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__); 
    211237 
    212238                        case SQLITE_ROW: 
     
    220246                                for (i = 0; i < numFields; ++i) 
    221247                                { 
    222                                         switch (sqlite3_column_type(sqliteResult, i)) 
     248                                        switch (sqlite3_column_type(handle->result, i)) 
    223249                                        { 
    224250                                                case SQLITE_INTEGER: 
    225251 
    226                                                         rowsPart.push_back(tools::string::iToString(sqlite3_column_int(sqliteResult, i))); 
     252                                                        rowsPart.push_back(tools::string::iToString(sqlite3_column_int(handle->result, i))); 
    227253 
    228254                                                        break; 
     
    230256                                                case SQLITE_FLOAT: 
    231257 
    232                                                         rowsPart.push_back(tools::string::dToString(sqlite3_column_double(sqliteResult, i))); 
     258                                                        rowsPart.push_back(tools::string::dToString(sqlite3_column_double(handle->result, i))); 
    233259 
    234260                                                        break; 
     
    236262                                                case SQLITE_TEXT: 
    237263 
    238                                                         rowsPart.push_back(dodoString((const char *)sqlite3_column_text(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i))); 
     264                                                        rowsPart.push_back(dodoString((const char *)sqlite3_column_text(handle->result, i), sqlite3_column_bytes(handle->result, i))); 
    239265 
    240266                                                        break; 
     
    242268                                                case SQLITE_BLOB: 
    243269 
    244                                                         rowsPart.push_back(dodoString((const char *)sqlite3_column_blob(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i))); 
     270                                                        rowsPart.push_back(dodoString((const char *)sqlite3_column_blob(handle->result, i), sqlite3_column_bytes(handle->result, i))); 
    245271 
    246272                                                        break; 
     
    273299sqlite::fetchFields() const 
    274300{ 
    275         if (sqliteHandle == NULL) 
     301        if (handle->handle == NULL) 
    276302        { 
    277303                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, SQLITEEX_NOTOPENED, DATABASESQLITEEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    290316        } 
    291317 
    292         unsigned int numFields = sqlite3_column_count(sqliteResult); 
     318        unsigned int numFields = sqlite3_column_count(handle->result); 
    293319 
    294320#ifndef USE_DEQUE 
     
    298324        for (unsigned int i(0); i < numFields; ++i) 
    299325        { 
    300                 fields.push_back(sqlite3_column_name(sqliteResult, i)); 
     326                fields.push_back(sqlite3_column_name(handle->result, i)); 
    301327        } 
    302328 
     
    321347sqlite::rowsCount() const 
    322348{ 
    323         if (sqliteHandle == NULL) 
     349        if (handle->handle == NULL) 
    324350        { 
    325351                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, SQLITEEX_NOTOPENED, DATABASESQLITEEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    328354        if (show) 
    329355        { 
    330                 sqlite3_reset(sqliteResult); 
     356                sqlite3_reset(handle->result); 
    331357 
    332358                unsigned int numRows = 0; 
     
    336362                while (iterate) 
    337363                { 
    338                         result = sqlite3_step(sqliteResult); 
     364                        result = sqlite3_step(handle->result); 
    339365                        switch (result) 
    340366                        { 
     
    351377                                case SQLITE_ERROR: 
    352378 
    353                                         throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     379                                        throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHROWS, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__); 
    354380 
    355381                                case SQLITE_ROW: 
     
    374400sqlite::fieldsCount() const 
    375401{ 
    376         if (sqliteHandle == NULL) 
     402        if (handle->handle == NULL) 
    377403        { 
    378404                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, SQLITEEX_NOTOPENED, DATABASESQLITEEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    381407        if (show) 
    382408        { 
    383                 return sqlite3_column_count(sqliteResult); 
     409                return sqlite3_column_count(handle->result); 
    384410        } 
    385411        else 
     
    394420sqlite::affectedRowsCount() const 
    395421{ 
    396         if (sqliteHandle == NULL) 
     422        if (handle->handle == NULL) 
    397423        { 
    398424                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, SQLITEEX_NOTOPENED, DATABASESQLITEEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    401427        if (!show) 
    402428        { 
    403                 return sqlite3_changes(sqliteHandle); 
     429                return sqlite3_changes(handle->handle); 
    404430        } 
    405431        else 
     
    414440sqlite::getFieldsTypes(const dodoString &table) 
    415441{ 
    416         if (sqliteHandle == NULL) 
     442        if (handle->handle == NULL) 
    417443        { 
    418444                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, SQLITEEX_NOTOPENED, DATABASESQLITEEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    429455 
    430456#ifdef SQLITE_ENABLE_COLUMN_METADATA 
    431  
    432457        request = "select * from " + table + " limit 1"; 
    433458 
    434459        if (!empty) 
    435460        { 
    436                 sqlite3_finalize(sqliteResult); 
     461                sqlite3_finalize(handle->result); 
    437462                empty = true; 
    438463        } 
    439464 
    440         if (sqlite3_prepare(sqliteHandle, request.c_str(), request.size(), &sqliteResult, NULL) != SQLITE_OK) 
    441         { 
    442                 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__, request); 
    443         } 
    444  
    445         if (sqliteResult == NULL) 
    446         { 
    447                 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     465        if (sqlite3_prepare(handle->handle, request.c_str(), request.size(), &handle->result, NULL) != SQLITE_OK) 
     466        { 
     467                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__, request); 
     468        } 
     469 
     470        if (handle->result == NULL) 
     471        { 
     472                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__); 
    448473        } 
    449474 
    450475        empty = false; 
    451476 
    452         unsigned int numFields = sqlite3_column_count(sqliteResult); 
     477        unsigned int numFields = sqlite3_column_count(handle->result); 
    453478 
    454479        const char *columnType, *columnName; 
     
    458483        for (unsigned int i(0); i < numFields; ++i) 
    459484        { 
    460                 columnName = sqlite3_column_name(sqliteResult, i); 
    461  
    462                 if (sqlite3_table_column_metadata(sqliteHandle, 
     485                columnName = sqlite3_column_name(handle->result, i); 
     486 
     487                if (sqlite3_table_column_metadata(handle->handle, 
    463488                                                                                  NULL, 
    464489                                                                                  table.c_str(), 
     
    472497                        if (!empty) 
    473498                        { 
    474                                 sqlite3_finalize(sqliteResult); 
     499                                sqlite3_finalize(handle->result); 
    475500                                empty = true; 
    476501                        } 
    477502 
    478                         throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__, request); 
     503                        throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__, request); 
    479504                } 
    480505 
     
    531556        if (!empty) 
    532557        { 
    533                 sqlite3_finalize(sqliteResult); 
     558                sqlite3_finalize(handle->result); 
    534559                empty = true; 
    535560        } 
    536  
    537561#else 
    538  
    539562        request = "pragma table_info(" + table + ")"; 
    540563 
    541564        if (!empty) 
    542565        { 
    543                 sqlite3_finalize(sqliteResult); 
     566                sqlite3_finalize(handle->result); 
    544567                empty = true; 
    545568        } 
    546569 
    547         if (sqlite3_prepare(sqliteHandle, request.c_str(), request.size(), &sqliteResult, NULL) != SQLITE_OK) 
    548         { 
    549                 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__, request); 
    550         } 
    551  
    552         if (sqliteResult == NULL) 
    553         { 
    554                 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     570        if (sqlite3_prepare(handle->handle, request.c_str(), request.size(), &handle->result, NULL) != SQLITE_OK) 
     571        { 
     572                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__, request); 
     573        } 
     574 
     575        if (handle->result == NULL) 
     576        { 
     577                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__); 
    555578        } 
    556579 
     
    565588        while (iterate) 
    566589        { 
    567                 switch (sqlite3_step(sqliteResult)) 
     590                switch (sqlite3_step(handle->result)) 
    568591                { 
    569592                        case SQLITE_BUSY: 
     
    579602                        case SQLITE_ERROR: 
    580603 
    581                                 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     604                                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__); 
    582605 
    583606                        case SQLITE_ROW: 
    584607 
    585                                 columnName = (const char *)sqlite3_column_text(sqliteResult, 1); 
    586                                 columnType = (const char *)sqlite3_column_text(sqliteResult, 2); 
     608                                columnName = (const char *)sqlite3_column_text(handle->result, 1); 
     609                                columnType = (const char *)sqlite3_column_text(handle->result, 2); 
    587610 
    588611                                field = types->second.find(columnName); 
     
    641664        if (!empty) 
    642665        { 
    643                 sqlite3_finalize(sqliteResult); 
     666                sqlite3_finalize(handle->result); 
    644667                empty = true; 
    645668        } 
    646  
    647669#endif 
    648670 
     
    656678                         bool             result) 
    657679{ 
    658         if (sqliteHandle == NULL) 
     680        if (handle->handle == NULL) 
    659681        { 
    660682                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, SQLITEEX_NOTOPENED, DATABASESQLITEEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    678700        if (!empty) 
    679701        { 
    680                 sqlite3_finalize(sqliteResult); 
     702                sqlite3_finalize(handle->result); 
    681703                empty = true; 
    682704        } 
    683705 
    684         if (sqlite3_prepare(sqliteHandle, request.c_str(), request.size(), &sqliteResult, NULL) != SQLITE_OK) 
    685         { 
    686                 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_EXEC, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__, request); 
     706        if (sqlite3_prepare(handle->handle, request.c_str(), request.size(), &handle->result, NULL) != SQLITE_OK) 
     707        { 
     708                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_EXEC, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__, request); 
    687709        } 
    688710 
     
    690712        for (; i != j; ++i) 
    691713        { 
    692                 if (sqlite3_bind_blob(sqliteResult, i->reference, i->value->c_str(), i->value->size(), SQLITE_TRANSIENT) != SQLITE_OK) 
     714                if (sqlite3_bind_blob(handle->result, i->reference, i->value->c_str(), i->value->size(), SQLITE_TRANSIENT) != SQLITE_OK) 
    693715                { 
    694716                        blobs.clear(); 
    695717 
    696                         throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_EXEC, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     718                        throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_EXEC, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__); 
    697719                } 
    698720        } 
     
    700722        blobs.clear(); 
    701723 
    702         if (sqliteResult == NULL) 
    703         { 
    704                 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_EXEC, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     724        if (handle->result == NULL) 
     725        { 
     726                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_EXEC, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__); 
    705727        } 
    706728 
     
    709731        if (!show) 
    710732        { 
    711                 if (sqlite3_step(sqliteResult) != SQLITE_DONE) 
    712                 { 
    713                         throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_EXEC, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     733                if (sqlite3_step(handle->result) != SQLITE_DONE) 
     734                { 
     735                        throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_EXEC, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__); 
    714736                } 
    715737        } 
     
    10481070sqlite::fetchFieldsToRows() const 
    10491071{ 
    1050         if (sqliteHandle == NULL) 
     1072        if (handle->handle == NULL) 
    10511073        { 
    10521074                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_LIBDODO, SQLITEEX_NOTOPENED, DATABASESQLITEEX_NOTOPENED_STR, __LINE__, __FILE__); 
     
    10601082        } 
    10611083 
    1062         sqlite3_reset(sqliteResult); 
    1063  
    1064         unsigned int numFields = sqlite3_column_count(sqliteResult); 
     1084        sqlite3_reset(handle->result); 
     1085 
     1086        unsigned int numFields = sqlite3_column_count(handle->result); 
    10651087 
    10661088        bool iterate = true; 
     
    10711093 
    10721094#ifndef USE_DEQUE 
    1073         rowsFields.reserve(sqlite3_data_count(sqliteResult)); 
     1095        rowsFields.reserve(sqlite3_data_count(handle->result)); 
    10741096#endif 
    10751097 
    10761098        while (iterate) 
    10771099        { 
    1078                 switch (sqlite3_step(sqliteResult)) 
     1100                switch (sqlite3_step(handle->result)) 
    10791101                { 
    10801102                        case SQLITE_BUSY: 
     
    10901112                        case SQLITE_ERROR: 
    10911113 
    1092                                 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHFIELDSTOROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     1114                                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHFIELDSTOROWS, exception::ERRNO_SQLITE, sqlite3_errcode(handle->handle), sqlite3_errmsg(handle->handle), __LINE__, __FILE__); 
    10931115 
    10941116                        case SQLITE_ROW: 
     
    10981120                                for (i = 0; i < numFields; ++i) 
    10991121                                { 
    1100                                         switch (sqlite3_column_type(sqliteResult, i)) 
     1122                                        switch (sqlite3_column_type(handle->result, i)) 
    11011123                                        { 
    11021124                                                case SQLITE_INTEGER: 
    11031125 
    1104                                                         rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), tools::string::iToString(sqlite3_column_int(sqliteResult, i)))); 
     1126                                                        rowFieldsPart.insert(make_pair(sqlite3_column_name(handle->result, i), tools::string::iToString(sqlite3_column_int(handle->result, i)))); 
    11051127 
    11061128                                                        break; 
     
    11081130                                                case SQLITE_FLOAT: 
    11091131 
    1110                                                         rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), tools::string::dToString(sqlite3_column_double(sqliteResult, i)))); 
     1132                                                        rowFieldsPart.insert(make_pair(sqlite3_column_name(handle->result, i), tools::string::dToString(sqlite3_column_double(handle->result, i)))); 
    11111133 
    11121134                                                        break; 
     
    11141136                                                case SQLITE_TEXT: 
    11151137 
    1116                                                         rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), dodoString((const char *)sqlite3_column_text(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i)))); 
     1138                                                        rowFieldsPart.insert(make_pair(sqlite3_column_name(handle->result, i), dodoString((const char *)sqlite3_column_text(handle->result, i), sqlite3_column_bytes(handle->result, i)))); 
    11171139 
    11181140                                                        break; 
     
    11201142                                                case SQLITE_BLOB: 
    11211143 
    1122                                                         rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), dodoString((const char *)sqlite3_column_blob(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i)))); 
     1144                                                        rowFieldsPart.insert(make_pair(sqlite3_column_name(handle->result, i), dodoString((const char *)sqlite3_column_blob(handle->result, i), sqlite3_column_bytes(handle->result, i)))); 
    11231145 
    11241146                                                        break; 
     
    11271149                                                default: 
    11281150 
    1129                                                         rowFieldsPart.insert(make_pair(dodoString(sqlite3_column_name(sqliteResult, i)), statements[SQLCONSTRUCTOR_STATEMENT_NULL])); 
     1151                                                        rowFieldsPart.insert(make_pair(dodoString(sqlite3_column_name(handle->result, i)), statements[SQLCONSTRUCTOR_STATEMENT_NULL])); 
    11301152 
    11311153                                                        break; 
  • trunk/src/pcSyncProtector.cc

    r1166 r1167  
    3232using namespace dodo::pc::sync; 
    3333 
    34 protector::protector(section *a_keeper) : keeper(a_keeper) 
     34protector::protector(section *keeper) : keeper(keeper) 
    3535{ 
    3636        if (keeper != NULL)