Changeset 1166:323375b3253d


Ignore:
Timestamp:
02/22/09 18:12:08 (3 years ago)
Author:
niam
Branch:
libdodo
Message:

resoled issue #24

Files:
61 edited

Legend:

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

    r1164 r1166  
    214214                         */ 
    215215                        __cgiCookie(const dodoString &name, 
    216                                                 const dodoString &value, 
    217                                                 const dodoString &exDate, 
    218                                                 const dodoString &path, 
    219                                                 const dodoString &domain, 
    220                                                 bool                    secure); 
    221  
    222                         dodoString name;                            ///< name of the cookie 
    223                         dodoString value;                           ///< value of the cookie 
    224  
    225                         dodoString expires;                         ///< expiration date 
    226                         dodoString path;                            ///< cookie path 
    227                         dodoString domain;                          ///< cookie domain 
    228                         bool       secure;                          ///< defines cookie security; false by default 
     216                                                const            dodoString &value, 
     217                                                const            dodoString &exDate, 
     218                                                const            dodoString &path, 
     219                                                const            dodoString &domain, 
     220                                                bool            secure); 
     221 
     222                        dodoString name;            ///< name of the cookie 
     223                        dodoString value;           ///< value of the cookie 
     224 
     225                        dodoString expires;         ///< expiration date 
     226                        dodoString path;            ///< cookie path 
     227                        dodoString domain;          ///< cookie domain 
     228                        bool       secure;          ///< defines cookie security; false by default 
    229229                }; 
    230230 
     
    236236                        CGI_REQUESTMETHOD_GET, 
    237237                        CGI_REQUESTMETHOD_POST, 
    238                         CGI_REQUESTMETHOD_GET_POST                  ///< if POST method and request Url also contains ?name=value&.... format data 
     238                        CGI_REQUESTMETHOD_GET_POST  ///< if POST method and request Url also contains ?name=value&.... format data 
    239239                }; 
    240240 
     
    255255                struct __cgiAuthInfo 
    256256                { 
    257                         dodoString user;                            ///< user name 
    258                         short      type;                            ///< authenfication type[see cgiAuthTypeEnum] 
     257                        dodoString user;            ///< user name 
     258                        short      type;            ///< authenfication type[see cgiAuthTypeEnum] 
    259259                }; 
    260260        }; 
  • trunk/include/libdodo/cgiBasicExchange.h

    r1160 r1166  
    6262                                /** 
    6363                                 * constructor 
     64                                 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    6465                                 */ 
    65                                 exchange(); 
     66                                exchange(short protection = io::CHANNEL_PROTECTION_PROCESS); 
    6667 
    6768                                /** 
  • trunk/include/libdodo/cgiDialogue.h

    r1164 r1166  
    9393                         * @param postFilesTmpDir defines directory for POST files if on they are saved on the disk 
    9494                         */ 
    95                         dialogue(exchange &cf, 
    96                                          bool           silent = false, 
    97                                          bool           autocleanFiles = true, 
    98                                          bool           postFilesInMem = true, 
     95                        dialogue(exchange   &cf, 
     96                                         bool       silent = false, 
     97                                         bool       autocleanFiles = true, 
     98                                         bool       postFilesInMem = true, 
    9999                                         dodoString postFilesTmpDir = "/tmp/"); 
    100100 
     
    108108                         * @param postFilesTmpDir defines directory for POST files if on they are saved on the disk 
    109109                         */ 
    110                         dialogue(exchange                                       &cf, 
     110                        dialogue(exchange &cf, 
    111111                                         dodoMap<short, dodoString> &headers, 
    112                                          bool                                           silent = false, 
    113                                          bool                                           autocleanFiles = true, 
    114                                          bool                                           postFilesInMem = true, 
    115                                          dodoString                                     postFilesTmpDir = "/tmp/"); 
     112                                         bool silent = false, 
     113                                         bool autocleanFiles = true, 
     114                                         bool postFilesInMem = true, 
     115                                         dodoString postFilesTmpDir = "/tmp/"); 
    116116 
    117117                        /** 
  • trunk/include/libdodo/cgiExchange.h

    r1160 r1166  
    4949 
    5050                        /** 
     51                         * constructor 
     52                         */ 
     53                        exchange(short protection); 
     54 
     55                        /** 
    5156                         * destructor 
    5257                         */ 
  • trunk/include/libdodo/cgiFastExchange.h

    r1161 r1166  
    6767                                 * constructor 
    6868                                 * @param request defines CGI request descriptor 
     69                                 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    6970                                 */ 
    70                                 exchange(FCGX_Request *request); 
     71                                exchange(FCGX_Request *request, 
     72                                                 short        protection = io::CHANNEL_PROTECTION_PROCESS); 
    7173 
    7274                                /** 
  • trunk/include/libdodo/cgiFastServer.h

    r1164 r1166  
    8282                                 */ 
    8383                                server(unsigned long limit = 0, 
    84                                            bool                  threading = true, 
    85                                            unsigned int  threadsNum = 10); 
     84                                           bool          threading = true, 
     85                                           unsigned int  threadsNum = 10); 
    8686 
    8787#else 
  • trunk/include/libdodo/dataBaseConnector.h

    r1164 r1166  
    8282                                 */ 
    8383                                __tuples(dodoArray<dodoStringArray> rows, 
    84                                                  dodoStringArray                        fields); 
     84                                                 dodoStringArray            fields); 
    8585 
    8686                                /** 
     
    114114                                 */ 
    115115                                __connectionInfo(const dodoString &db, 
    116                                                                  const dodoString &host, 
    117                                                                  const dodoString &user, 
    118                                                                  const dodoString &password, 
    119                                                                  const dodoString &path = __dodostring__, 
    120                                                                  int                      port = 0); 
    121  
    122                                 dodoString   db;                    ///< database name 
    123                                 dodoString   host;                  ///< hostname 
    124                                 dodoString   user;                  ///< username 
    125                                 dodoString   password;              ///< password 
    126                                 dodoString   path;                  ///< path to db or unix socket 
    127                                 unsigned int port;                  ///< port 
     116                                                                 const            dodoString &host, 
     117                                                                 const            dodoString &user, 
     118                                                                 const            dodoString &password, 
     119                                                                 const            dodoString &path = __dodostring__, 
     120                                                                 int              port = 0); 
     121 
     122                                dodoString   db;        ///< database name 
     123                                dodoString   host;      ///< hostname 
     124                                dodoString   user;      ///< username 
     125                                dodoString   password;  ///< password 
     126                                dodoString   path;      ///< path to db or unix socket 
     127                                unsigned int port;      ///< port 
    128128                        }; 
    129129 
  • trunk/include/libdodo/dataFormatXmlNode.h

    r1164 r1166  
    9494                                         * @param ns defines node namespace 
    9595                                         */ 
    96                                         node(const dodoString    &name, 
     96                                        node(const dodoString    &name, 
    9797                                                 const dodoStringMap &attributes, 
    98                                                  const dodoString        &value, 
    99                                                  const dodoString        &ns = __dodostring__); 
     98                                                 const dodoString    &value, 
     99                                                 const dodoString    &ns = __dodostring__); 
    100100 
    101101                                        /** 
  • trunk/include/libdodo/dataFormatXmlProcessor.h

    r1164 r1166  
    6868                                         */ 
    6969                                        __nodeDef(const dodoString &name, 
    70                                                           const dodoString &ns = __dodostring__); 
     70                                                          const            dodoString &ns = __dodostring__); 
    7171 
    7272                                        dodoString                     name;            ///< name of the node [[tag]]; if empty - for first - gets root, for children - all[but if children do not have in definition own children] 
     
    9797                                         */ 
    9898                                        __info(const dodoString &version, 
    99                                                    const dodoString &encoding, 
    100                                                    const dodoString &root, 
    101                                                    int                          compression); 
     99                                                   const            dodoString &encoding, 
     100                                                   const            dodoString &root, 
     101                                                   int              compression); 
    102102 
    103103                                        dodoString version;                             ///< version of XML document 
  • trunk/include/libdodo/exceptionBasic.h

    r1163 r1166  
    143143                }; 
    144144 
    145 #define BASEEX_MODULES    51 
     145#define BASEEX_MODULES    51 
    146146 
    147147#ifdef DL_EXT 
     
    153153                struct __basicMod 
    154154                { 
    155                         char  name[64];                 ///< name of the library 
     155                        char  name[64];         ///< name of the library 
    156156                        char  discription[256]; ///< discription of the library 
    157                         char  hook[64];                 ///< name of the function in module that will be as a hook 
    158                         short module;                   ///< for what module handler should be set[see errorModuleEnum] 
     157                        char  hook[64];         ///< name of the function in module that will be as a hook 
     158                        short module;           ///< for what module handler should be set[see errorModuleEnum] 
    159159                }; 
    160160 
     
    193193                struct __call 
    194194                { 
    195                         dodoString object;              ///< name of the object where call was found 
    196                         dodoString symbol;              ///< name of the call 
    197                         void       *address;    ///< address of the call 
     195                        dodoString object;      ///< name of the object where call was found 
     196                        dodoString symbol;      ///< name of the call 
     197                        void       *address;    ///< address of the call 
    198198                }; 
    199199 
     
    229229                         * @param message defines custom message that might clarify the exception 
    230230                         */ 
    231                         basic(int                          errModule, 
    232                                   int                      functionID, 
    233                                   int                      errnoSource, 
    234                                   int                      baseErrno, 
     231                        basic(int              errModule, 
     232                                  int              functionID, 
     233                                  int              errnoSource, 
     234                                  int              baseErrno, 
    235235                                  const dodoString &baseErrstr, 
    236                                   unsigned long    line, 
     236                                  unsigned long    line, 
    237237                                  const dodoString &file, 
    238238                                  const dodoString &message = __dodostring__) throw (); 
     
    262262#endif 
    263263 
    264                         int errModule;                                  ///< module where exception has been thrown 
    265                         int funcID;                                             ///< function where exception has been thrown[see *Ex.h headers for IDs] 
    266                         int errnoSource;                                ///< the source of the error code and of the error string 
    267  
    268                         int baseErrno;                                  ///< error code 
    269                         dodoString baseErrstr;                  ///< error string 
    270  
    271                         unsigned long line;                             ///< line where exception has been thrown 
    272                         dodoString file;                                ///< file where exception has been thrown 
    273  
    274                         dodoString message;                             ///< custom message that might clarify the exception 
     264                        int errModule;                  ///< module where exception has been thrown 
     265                        int funcID;                     ///< function where exception has been thrown[see *Ex.h headers for IDs] 
     266                        int errnoSource;                ///< the source of the error code and of the error string 
     267 
     268                        int baseErrno;                  ///< error code 
     269                        dodoString baseErrstr;          ///< error string 
     270 
     271                        unsigned long line;             ///< line where exception has been thrown 
     272                        dodoString file;                ///< file where exception has been thrown 
     273 
     274                        dodoString message;             ///< custom message that might clarify the exception 
    275275 
    276276#ifdef CALLSTACK_EX 
    277277 
    278                         dodoArray<__call> callStack;    ///< call stack of the raised exception 
     278                        dodoArray<__call> callStack;    ///< call stack of the raised exception 
    279279 
    280280#endif 
     
    287287                         */ 
    288288                        static void setErrorHandler(errorModuleEnum module, 
    289                                                                                 errorHandler    handler, 
    290                                                                                 void                    *data); 
     289                                                                                errorHandler    handler, 
     290                                                                                void            *data); 
    291291 
    292292                        /** 
     
    296296                         */ 
    297297                        static void setErrorHandlers(errorHandler handler, 
    298                                                                                  void             *data); 
     298                                                                                 void         *data); 
    299299 
    300300                        /** 
     
    317317                         */ 
    318318                        static __basicMod getModuleInfo(const dodoString &path, 
    319                                                                                         void                    *toInit = NULL); 
     319                                                                                        void            *toInit = NULL); 
    320320 
    321321                        /** 
     
    328328                         */ 
    329329                        static bool setErrorHandler(const dodoString &path, 
    330                                                                                 void                    *data, 
    331                                                                                 void                    *toInit = NULL); 
     330                                                                                void            *data, 
     331                                                                                void            *toInit = NULL); 
    332332 
    333333                        /** 
     
    339339                         */ 
    340340                        static bool setErrorHandlers(const dodoString &path, 
    341                                                                                  void                     *data, 
    342                                                                                  void                     *toInit = NULL); 
     341                                                                                 void             *data, 
     342                                                                                 void             *toInit = NULL); 
    343343 
    344344#endif 
     
    348348                        static errorHandler handlersEx[BASEEX_MODULES]; ///< exception handlers 
    349349 
    350                         static bool handlerSetEx[BASEEX_MODULES];               ///< map of set handlers 
    351  
    352                         static void *handlerDataEx[BASEEX_MODULES];             ///< data that will be passed to the handler 
     350                        static bool handlerSetEx[BASEEX_MODULES];       ///< map of set handlers 
     351 
     352                        static void *handlerDataEx[BASEEX_MODULES];     ///< data that will be passed to the handler 
    353353 
    354354#ifdef DL_EXT 
    355355 
    356                         static void *handlesEx[BASEEX_MODULES];                 ///< handles to the libraries 
    357  
    358                         static bool handlesOpenedEx[BASEEX_MODULES];    ///< map of the opened libraries 
     356                        static void *handlesEx[BASEEX_MODULES];         ///< handles to the libraries 
     357 
     358                        static bool handlesOpenedEx[BASEEX_MODULES];    ///< map of the opened libraries 
    359359 
    360360#endif 
     
    392392#ifdef PTHREAD_EXT 
    393393 
    394                                 static pthread_mutex_t keeper;  ///< mutex 
     394                                static pthread_mutex_t keeper;  ///< mutex 
    395395 
    396396#endif 
    397397                        }; 
    398398 
    399                         static syncThreadSection keeper;        ///< lock 
     399                        static syncThreadSection keeper;    ///< lock 
    400400 
    401401                        /** 
  • trunk/include/libdodo/ioChannel.h

    r1164 r1166  
    3737#include <libdodo/ioEventInfo.h> 
    3838#include <libdodo/pcSyncProcessSection.h> 
     39#include <libdodo/pcSyncThreadSection.h> 
    3940#include <libdodo/pcSyncProtector.h> 
    4041 
     
    4445        { 
    4546                /** 
    46                  * @enum exchangeOperationTypeEnum describes type of operation for hook 
     47                 * @enum channelProtectionTypeEnum defines type of protection for io objects 
     48                 * in IO interaction in parallel environment 
    4749                 */ 
    48                 enum exchangeOperationTypeEnum 
     50                enum channelProtectionTypeEnum 
     51                { 
     52                        CHANNEL_PROTECTION_NONE, 
     53                        CHANNEL_PROTECTION_THREAD, 
     54                        CHANNEL_PROTECTION_PROCESS 
     55                }; 
     56                /** 
     57                 * @enum ioOperationTypeEnum describes type of operation for hook 
     58                 */ 
     59                enum ioOperationTypeEnum 
    4960                { 
    5061                        IO_OPERATION_READ, 
     
    95106                        /** 
    96107                         * constructor 
     108                         * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    97109                         */ 
    98                         channel(); 
     110                        channel(short protection); 
    99111 
    100112                        /** 
     
    167179#ifndef IO_WO_XEXEC 
    168180 
    169                         __xexecIoChannelCollectedData collectedData; ///< data collected for xexec 
     181                        __xexecIoChannelCollectedData collectedData;    ///< data collected for xexec 
    170182 
    171183#endif 
    172                         pc::sync::section *keeper;                                                       ///< section locker 
     184                        pc::sync::section *keeper;                      ///< section locker 
     185                        short protection;                               ///< type of IO protection[see channelProtectionTypeEnum] 
    173186                }; 
    174187        }; 
  • trunk/include/libdodo/ioEvent.h

    r1161 r1166  
    139139                        int descs;                                  ///< descriptors counter 
    140140 
    141                         pc::sync::section *keeper;                                      ///< section locker 
     141                        pc::sync::section *keeper;                  ///< section locker 
    142142                }; 
    143143        }; 
  • trunk/include/libdodo/ioFileFifo.h

    r1164 r1166  
    8383                                /** 
    8484                                 * constructor 
     85                                 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    8586                                 */ 
    86                                 fifo(); 
     87                                fifo(short protection = CHANNEL_PROTECTION_PROCESS); 
    8788 
    8889                                /** 
     
    9091                                 * @param path defines path to the file 
    9192                                 * @param mode defines mode to open file[see fifoOpenmodeEnum] 
     93                                 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    9294                                 */ 
    9395                                fifo(const dodoString &path, 
    94                                          short                    mode); 
     96                                         short            mode, 
     97                                         short            protection = CHANNEL_PROTECTION_PROCESS); 
    9598 
    9699                                /** 
  • trunk/include/libdodo/ioFileRegular.h

    r1164 r1166  
    8888                                /** 
    8989                                 * constructor 
     90                                 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
     91                                 */ 
     92                                regular(short protection = CHANNEL_PROTECTION_PROCESS); 
     93 
     94                                /** 
     95                                 * constructor 
    9096                                 * @param path defines path to the file 
    9197                                 * @param mode defines mode to open file[see regularOpenmodeEnum] 
     98                                 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    9299                                 */ 
    93100                                regular(const dodoString &path, 
    94                                                 short                    mode); 
    95  
    96                                 /** 
    97                                  * constructor 
    98                                  */ 
    99                                 regular(); 
     101                                                short            mode, 
     102                                                short            protection = CHANNEL_PROTECTION_PROCESS); 
    100103 
    101104                                /** 
  • trunk/include/libdodo/ioFileTemp.h

    r1160 r1166  
    7878                                 * constructor 
    7979                                 * @param open defines whether temp file should be opened in constructor 
     80                                 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    8081                                 */ 
    81                                 temp(bool open = false); 
     82                                temp(bool  open = false, 
     83                                         short protection = CHANNEL_PROTECTION_PROCESS); 
    8284 
    8385                                /** 
  • trunk/include/libdodo/ioMemory.h

    r1163 r1166  
    6060                        /** 
    6161                         * constructor 
     62                         * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    6263                         */ 
    63                         memory(); 
     64                        memory(short protection = CHANNEL_PROTECTION_PROCESS); 
    6465 
    6566                        /** 
     
    7071 
    7172                        /** 
    72                          * copy constructor 
    73                          * @note xexec object is not copied 
     73                         * constructor 
     74                         * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    7475                         */ 
    75                         memory(const dodoString &data); 
     76                        memory(const dodoString &data, 
     77                                   short            protection = CHANNEL_PROTECTION_PROCESS); 
    7678 
    7779                        /** 
  • trunk/include/libdodo/ioNetworkExchange.h

    r1161 r1166  
    112112                                /** 
    113113                                 * constructor 
    114                                  */ 
    115                                 exchange(); 
     114                                 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
     115                                 */ 
     116                                exchange(short protection = CHANNEL_PROTECTION_PROCESS); 
    116117 
    117118                                /** 
     
    125126                                 * constructor 
    126127                                 * @param init is initial data[got from the ::accept method] 
     128                                 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    127129                                 * @note the object that has inited the object of current instance can be used for another connections 
    128130                                 */ 
    129                                 exchange(__initialAccept &init); 
     131                                exchange(__initialAccept &init, 
     132                                                 short           protection = CHANNEL_PROTECTION_PROCESS); 
    130133 
    131134                                /** 
  • trunk/include/libdodo/ioNetworkSslExchange.h

    r1161 r1166  
    111111                                        /** 
    112112                                         * constructor 
    113                                          */ 
    114                                         exchange(); 
     113                                         * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
     114                                         */ 
     115                                        exchange(short protection = CHANNEL_PROTECTION_PROCESS); 
    115116 
    116117                                        /** 
     
    124125                                         * constructor 
    125126                                         * @param init is initial data[got from the ::accept method] 
     127                                         * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    126128                                         * @note the object that has inited the object of current instance can be used for another connections 
    127129                                         */ 
    128                                         exchange(__initialAccept &init); 
     130                                        exchange(__initialAccept &init, 
     131                                                         short           protection = CHANNEL_PROTECTION_PROCESS); 
    129132 
    130133                                        /** 
  • trunk/include/libdodo/ioPipe.h

    r1161 r1166  
    7777                         * constructor 
    7878                         * @param open defines whether pipe should be opened in constructor 
     79                         * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    7980                         */ 
    80                         pipe(bool open = false); 
     81                        pipe(bool  open = false, 
     82                                 short protection = CHANNEL_PROTECTION_PROCESS); 
    8183 
    8284                        /** 
  • trunk/include/libdodo/ioStdio.h

    r1161 r1166  
    6565                        /** 
    6666                         * constructor 
     67                         * @param protection defines type of IO protection[see channelProtectionTypeEnum] 
    6768                         */ 
    68                         stdio(); 
     69                        stdio(short protection = CHANNEL_PROTECTION_PROCESS); 
    6970 
    7071                        /** 
  • trunk/include/libdodo/pcSyncProcessDataCollection.h

    r1161 r1166  
    124124                                                dodoList<pc::sync::data::__info>::iterator current; ///< iterator for list of shared data[for matched with getShare method] 
    125125 
    126                                                 section *keeper;                                                                        ///< section locker 
     126                                                section *keeper;                                    ///< section locker 
    127127                                        }; 
    128128                                }; 
  • trunk/include/libdodo/pcSyncThreadDataCollection.h

    r1161 r1166  
    124124                                                dodoList<pc::sync::data::__info>::iterator current; ///< iterator for list of shared data[for matched with getShare method] 
    125125 
    126                                                 section *keeper;                                                                        ///< section locker 
     126                                                section *keeper;                                    ///< section locker 
    127127                                        }; 
    128128                                }; 
  • trunk/include/libdodo/toolsLogger.h

    r1161 r1166  
    136136                        static const int syslogLevels[LOGGER_LEVELS];   ///< syslog log levels 
    137137 
    138                         pc::sync::section *keeper;                                              ///< section locker 
     138                        pc::sync::section *keeper;                      ///< section locker 
    139139                }; 
    140140        }; 
  • trunk/include/libdodo/toolsTime.h

    r1164 r1166  
    9595                                   unsigned int month, 
    9696                                   unsigned int year, 
    97                                    bool                 daylight = true); 
     97                                   bool         daylight = true); 
    9898 
    9999                        unsigned int sec;       ///< seconds [0, 60] 
     
    120120                         * @param month defines month[1, 12] 
    121121                         */ 
    122                         static unsigned short int daysInMonth(unsigned int       year, 
    123                                                                                                   unsigned short int month); 
     122                        static unsigned short daysInMonth(unsigned int   year, 
     123                                                                                          unsigned short month); 
    124124 
    125125                        /** 
  • trunk/include/libdodo/types.h

    r1160 r1166  
    122122                 * @return logger instance which can be used globally 
    123123                 */ 
    124                 static T &getInstance() 
     124                static T & 
     125                getInstance() 
    125126                { 
    126127                        static T t; 
  • trunk/src/cgiBasicExchange.cc

    r1162 r1166  
    3232using namespace dodo::cgi::basic; 
    3333 
    34 exchange::exchange(exchange &cf) 
     34exchange::exchange(exchange &cf) : dodo::cgi::exchange(cf.protection), 
     35                                                                   io::channel(cf.protection) 
    3536{ 
    3637} 
     
    3839//------------------------------------------------------------------- 
    3940 
    40 exchange::exchange() 
     41exchange::exchange(short protection) : dodo::cgi::exchange(protection), 
     42                                                                           io::channel(protection) 
    4143{ 
    4244#ifndef IO_WO_XEXEC 
  • trunk/src/cgiDialogue.cc

    r1162 r1166  
    862862                                                                        switch (errno) 
    863863                                                                        { 
    864                                                                         case EACCES: 
    865                                                                         case EISDIR: 
    866  
    867                                                                                 file.error = CGI_POSTFILEERR_ACCESS_DENY; 
    868  
    869                                                                                 break; 
    870  
    871                                                                         case ENAMETOOLONG: 
    872                                                                         case ENOTDIR: 
    873  
    874                                                                                 file.error = CGI_POSTFILEERR_BAD_FILE_NAME; 
    875  
    876                                                                                 break; 
    877  
    878                                                                         case ENOMEM: 
    879  
    880                                                                                 file.error = CGI_POSTFILEERR_NO_SPACE; 
    881  
    882                                                                                 break; 
    883  
    884                                                                         default: 
    885  
    886                                                                                 throw exception::basic(exception::ERRMODULE_CGIDIALOGUE, DIALOGUEEX_MAKEPOST, exception::ERRNO_ERRNO, errno, strerror(errno), __LINE__, __FILE__); 
     864                                                                                case EACCES: 
     865                                                                                case EISDIR: 
     866 
     867                                                                                        file.error = CGI_POSTFILEERR_ACCESS_DENY; 
     868 
     869                                                                                        break; 
     870 
     871                                                                                case ENAMETOOLONG: 
     872                                                                                case ENOTDIR: 
     873 
     874                                                                                        file.error = CGI_POSTFILEERR_BAD_FILE_NAME; 
     875 
     876                                                                                        break; 
     877 
     878                                                                                case ENOMEM: 
     879 
     880                                                                                        file.error = CGI_POSTFILEERR_NO_SPACE; 
     881 
     882                                                                                        break; 
     883 
     884                                                                                default: 
     885 
     886                                                                                        throw exception::basic(exception::ERRMODULE_CGIDIALOGUE, DIALOGUEEX_MAKEPOST, exception::ERRNO_ERRNO, errno, strerror(errno), __LINE__, __FILE__); 
    887887                                                                        } 
    888888                                                                } 
  • trunk/src/cgiExchange.cc

    r975 r1166  
    3232using namespace dodo::cgi; 
    3333 
     34 
     35exchange::exchange(short protection) : channel(protection) 
     36{ 
     37} 
     38 
     39//------------------------------------------------------------------- 
     40 
    3441exchange::~exchange() 
    3542{ 
  • trunk/src/cgiFastExchange.cc

    r1162 r1166  
    3434using namespace dodo::cgi::fast; 
    3535 
    36 exchange::exchange(exchange &cf) 
     36exchange::exchange(exchange &cf) : dodo::cgi::exchange(cf.protection), 
     37                                                                   channel(cf.protection) 
    3738{ 
    3839} 
     
    4041//------------------------------------------------------------------- 
    4142 
    42 exchange::exchange(FCGX_Request *a_request) : request(a_request) 
     43exchange::exchange(FCGX_Request *a_request, 
     44                                   short        protection) : request(a_request), 
     45                                                                                          dodo::cgi::exchange(protection), 
     46                                                                                          channel(protection) 
    4347{ 
    4448#ifndef IO_WO_XEXEC 
  • trunk/src/dataBasePostgresql.cc

    r1162 r1166  
    427427        switch (status) 
    428428        { 
    429         case PGRES_EMPTY_QUERY: 
    430         case PGRES_BAD_RESPONSE: 
    431         case PGRES_NONFATAL_ERROR: 
    432         case PGRES_FATAL_ERROR: 
    433  
    434                 throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, status, PQerrorMessage(pgHandle), __LINE__, __FILE__); 
     429                case PGRES_EMPTY_QUERY: 
     430                case PGRES_BAD_RESPONSE: 
     431                case PGRES_NONFATAL_ERROR: 
     432                case PGRES_FATAL_ERROR: 
     433 
     434                        throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, status, PQerrorMessage(pgHandle), __LINE__, __FILE__); 
    435435        } 
    436436 
     
    576576        switch (status) 
    577577        { 
    578         case PGRES_EMPTY_QUERY: 
    579         case PGRES_BAD_RESPONSE: 
    580         case PGRES_NONFATAL_ERROR: 
    581         case PGRES_FATAL_ERROR: 
    582  
    583                 throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_EXEC, exception::ERRNO_MYSQL, status, PQerrorMessage(pgHandle), __LINE__, __FILE__); 
     578                case PGRES_EMPTY_QUERY: 
     579                case PGRES_BAD_RESPONSE: 
     580                case PGRES_NONFATAL_ERROR: 
     581                case PGRES_FATAL_ERROR: 
     582 
     583                        throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_EXEC, exception::ERRNO_MYSQL, status, PQerrorMessage(pgHandle), __LINE__, __FILE__); 
    584584        } 
    585585 
  • trunk/src/dataBaseSqlConstructor.cc

    r1162 r1166  
    485485        switch (collectedData.qType) 
    486486        { 
    487         case ACCUMULATOR_REQUEST_SELECT: 
    488  
    489                 selectCollect(); 
    490                 selectAction = true; 
    491  
    492                 break; 
    493  
    494         case ACCUMULATOR_REQUEST_INSERT: 
    495  
    496                 insertCollect(); 
    497                 additionalActions = false; 
    498  
    499                 break; 
    500  
    501         case ACCUMULATOR_REQUEST_UPDATE: 
    502  
    503                 updateCollect(); 
    504  
    505                 break; 
    506  
    507         case ACCUMULATOR_REQUEST_DELETE: 
    508  
    509                 delCollect(); 
    510  
    511                 break; 
    512  
    513         case ACCUMULATOR_REQUEST_INSERT_SELECT: 
    514  
    515                 insertSelectCollect(); 
    516                 selectAction = true; 
    517  
    518                 break; 
    519  
    520         case SUBREQUEST_UNION: 
    521         case SUBREQUEST_UNION_ALL: 
    522         case SUBREQUEST_MINUS: 
    523         case SUBREQUEST_INTERSECT: 
    524  
    525                 subCollect(); 
    526                 additionalActions = false; 
    527  
    528                 break; 
    529  
    530         case ACCUMULATOR_REQUEST_CALL_FUNCTION: 
    531  
    532                 callFunctionCollect(); 
    533                 selectAction = true; 
    534  
    535                 break; 
    536  
    537         case ACCUMULATOR_REQUEST_CALL_PROCEDURE: 
    538  
    539                 callProcedureCollect(); 
    540  
    541                 break; 
    542  
    543         default: 
    544  
    545                 additionalActions = false; 
     487                case ACCUMULATOR_REQUEST_SELECT: 
     488 
     489                        selectCollect(); 
     490                        selectAction = true; 
     491 
     492                        break; 
     493 
     494                case ACCUMULATOR_REQUEST_INSERT: 
     495 
     496                        insertCollect(); 
     497                        additionalActions = false; 
     498 
     499                        break; 
     500 
     501                case ACCUMULATOR_REQUEST_UPDATE: 
     502 
     503                        updateCollect(); 
     504 
     505                        break; 
     506 
     507                case ACCUMULATOR_REQUEST_DELETE: 
     508 
     509                        delCollect(); 
     510 
     511                        break; 
     512 
     513                case ACCUMULATOR_REQUEST_INSERT_SELECT: 
     514 
     515                        insertSelectCollect(); 
     516                        selectAction = true; 
     517 
     518                        break; 
     519 
     520                case SUBREQUEST_UNION: 
     521                case SUBREQUEST_UNION_ALL: 
     522                case SUBREQUEST_MINUS: 
     523                case SUBREQUEST_INTERSECT: 
     524 
     525                        subCollect(); 
     526                        additionalActions = false; 
     527 
     528                        break; 
     529 
     530                case ACCUMULATOR_REQUEST_CALL_FUNCTION: 
     531 
     532                        callFunctionCollect(); 
     533                        selectAction = true; 
     534 
     535                        break; 
     536 
     537                case ACCUMULATOR_REQUEST_CALL_PROCEDURE: 
     538 
     539                        callProcedureCollect(); 
     540 
     541                        break; 
     542 
     543                default: 
     544 
     545                        additionalActions = false; 
    546546        } 
    547547 
  • trunk/src/dataBaseSqlite.cc

    r1162 r1166  
    196196                switch (sqlite3_step(sqliteResult)) 
    197197                { 
    198                 case SQLITE_BUSY: 
    199  
    200                         continue; 
    201  
    202                 case SQLITE_DONE: 
    203  
    204                         iterate = false; 
    205  
    206                         break; 
    207  
    208                 case SQLITE_ERROR: 
    209  
    210                         throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
    211  
    212                 case SQLITE_ROW: 
    213  
    214                         rowsPart.clear(); 
     198                        case SQLITE_BUSY: 
     199 
     200                                continue; 
     201 
     202                        case SQLITE_DONE: 
     203 
     204                                iterate = false; 
     205 
     206                                break; 
     207 
     208                        case SQLITE_ERROR: 
     209 
     210                                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     211 
     212                        case SQLITE_ROW: 
     213 
     214                                rowsPart.clear(); 
    215215 
    216216#ifndef USE_DEQUE 
    217                         rowsPart.reserve(numFields); 
    218 #endif 
    219  
    220                         for (i = 0; i < numFields; ++i) 
    221                         { 
    222                                 switch (sqlite3_column_type(sqliteResult, i)) 
    223                                 { 
    224                                 case SQLITE_INTEGER: 
    225  
    226                                         rowsPart.push_back(tools::string::iToString(sqlite3_column_int(sqliteResult, i))); 
    227  
    228                                         break; 
    229  
    230                                 case SQLITE_FLOAT: 
    231  
    232                                         rowsPart.push_back(tools::string::dToString(sqlite3_column_double(sqliteResult, i))); 
    233  
    234                                         break; 
    235  
    236                                 case SQLITE_TEXT: 
    237  
    238                                         rowsPart.push_back(dodoString((const char *)sqlite3_column_text(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i))); 
    239  
    240                                         break; 
    241  
    242                                 case SQLITE_BLOB: 
    243  
    244                                         rowsPart.push_back(dodoString((const char *)sqlite3_column_blob(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i))); 
    245  
    246                                         break; 
    247  
    248                                 case SQLITE_NULL: 
    249                                 default: 
    250  
    251                                         rowsPart.push_back(statements[SQLCONSTRUCTOR_STATEMENT_NULL]); 
    252  
    253                                         break; 
    254                                 } 
    255                         } 
    256  
    257                         rows.push_back(rowsPart); 
    258  
    259                         break; 
     217                                rowsPart.reserve(numFields); 
     218#endif 
     219 
     220                                for (i = 0; i < numFields; ++i) 
     221                                { 
     222                                        switch (sqlite3_column_type(sqliteResult, i)) 
     223                                        { 
     224                                                case SQLITE_INTEGER: 
     225 
     226                                                        rowsPart.push_back(tools::string::iToString(sqlite3_column_int(sqliteResult, i))); 
     227 
     228                                                        break; 
     229 
     230                                                case SQLITE_FLOAT: 
     231 
     232                                                        rowsPart.push_back(tools::string::dToString(sqlite3_column_double(sqliteResult, i))); 
     233 
     234                                                        break; 
     235 
     236                                                case SQLITE_TEXT: 
     237 
     238                                                        rowsPart.push_back(dodoString((const char *)sqlite3_column_text(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i))); 
     239 
     240                                                        break; 
     241 
     242                                                case SQLITE_BLOB: 
     243 
     244                                                        rowsPart.push_back(dodoString((const char *)sqlite3_column_blob(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i))); 
     245 
     246                                                        break; 
     247 
     248                                                case SQLITE_NULL: 
     249                                                default: 
     250 
     251                                                        rowsPart.push_back(statements[SQLCONSTRUCTOR_STATEMENT_NULL]); 
     252 
     253                                                        break; 
     254                                        } 
     255                                } 
     256 
     257                                rows.push_back(rowsPart); 
     258 
     259                                break; 
    260260                } 
    261261        } 
     
    339339                        switch (result) 
    340340                        { 
    341                         case SQLITE_BUSY: 
    342  
    343                                 continue; 
    344  
    345                         case SQLITE_DONE: 
    346  
    347                                 iterate = false; 
    348  
    349                                 break; 
    350  
    351                         case SQLITE_ERROR: 
    352  
    353                                 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
    354  
    355                         case SQLITE_ROW: 
    356  
    357                                 ++numRows; 
    358  
    359                                 break; 
     341                                case SQLITE_BUSY: 
     342 
     343                                        continue; 
     344 
     345                                case SQLITE_DONE: 
     346 
     347                                        iterate = false; 
     348 
     349                                        break; 
     350 
     351                                case SQLITE_ERROR: 
     352 
     353                                        throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     354 
     355                                case SQLITE_ROW: 
     356 
     357                                        ++numRows; 
     358 
     359                                        break; 
    360360                        } 
    361361                } 
     
    567567                switch (sqlite3_step(sqliteResult)) 
    568568                { 
    569                 case SQLITE_BUSY: 
    570  
    571                         continue; 
    572  
    573                 case SQLITE_DONE: 
    574  
    575                         iterate = false; 
    576  
    577                         break; 
    578  
    579                 case SQLITE_ERROR: 
    580  
    581                         throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
    582  
    583                 case SQLITE_ROW: 
    584  
    585                         columnName = (const char *)sqlite3_column_text(sqliteResult, 1); 
    586                         columnType = (const char *)sqlite3_column_text(sqliteResult, 2); 
    587  
    588                         field = types->second.find(columnName); 
    589  
    590                         if (field == fieldsEnd) 
    591                         { 
    592                                 if (strcasestr(columnType, "char") != NULL || 
    593                                         strcasestr(columnType, "date") != NULL || 
    594                                         strcasestr(columnType, "time") != NULL || 
    595                                         strcasestr(columnType, "text") != NULL || 
    596                                         strcasestr(columnType, "enum") != NULL || 
    597                                         strcasestr(columnType, "set") != NULL) 
    598                                 { 
    599                                         types->second.insert(make_pair(dodoString(columnName), sql::FIELDTYPE_TEXT)); 
     569                        case SQLITE_BUSY: 
     570 
     571                                continue; 
     572 
     573                        case SQLITE_DONE: 
     574 
     575                                iterate = false; 
     576 
     577                                break; 
     578 
     579                        case SQLITE_ERROR: 
     580 
     581                                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     582 
     583                        case SQLITE_ROW: 
     584 
     585                                columnName = (const char *)sqlite3_column_text(sqliteResult, 1); 
     586                                columnType = (const char *)sqlite3_column_text(sqliteResult, 2); 
     587 
     588                                field = types->second.find(columnName); 
     589 
     590                                if (field == fieldsEnd) 
     591                                { 
     592                                        if (strcasestr(columnType, "char") != NULL || 
     593                                                strcasestr(columnType, "date") != NULL || 
     594                                                strcasestr(columnType, "time") != NULL || 
     595                                                strcasestr(columnType, "text") != NULL || 
     596                                                strcasestr(columnType, "enum") != NULL || 
     597                                                strcasestr(columnType, "set") != NULL) 
     598                                        { 
     599                                                types->second.insert(make_pair(dodoString(columnName), sql::FIELDTYPE_TEXT)); 
     600                                        } 
     601                                        else 
     602                                        { 
     603                                                if (strcasestr(columnType, "blob") != NULL) 
     604                                                { 
     605                                                        types->second.insert(make_pair(dodoString(columnName), sql::FIELDTYPE_BINARY)); 
     606                                                } 
     607                                                else 
     608                                                { 
     609                                                        types->second.insert(make_pair(dodoString(columnName), sql::FIELDTYPE_NUMERIC)); 
     610                                                } 
     611                                        } 
    600612                                } 
    601613                                else 
    602614                                { 
    603                                         if (strcasestr(columnType, "blob") != NULL) 
    604                                         { 
    605                                                 types->second.insert(make_pair(dodoString(columnName), sql::FIELDTYPE_BINARY)); 
     615                                        if (strcasestr(columnType, "char") != NULL || 
     616                                                strcasestr(columnType, "date") != NULL || 
     617                                                strcasestr(columnType, "time") != NULL || 
     618                                                strcasestr(columnType, "text") != NULL || 
     619                                                strcasestr(columnType, "enum") != NULL || 
     620                                                strcasestr(columnType, "set") != NULL) 
     621                                        { 
     622                                                field->second = sql::FIELDTYPE_TEXT; 
    606623                                        } 
    607624                                        else 
    608625                                        { 
    609                                                 types->second.insert(make_pair(dodoString(columnName), sql::FIELDTYPE_NUMERIC)); 
    610                                         } 
    611                                 } 
    612                         } 
    613                         else 
    614                         { 
    615                                 if (strcasestr(columnType, "char") != NULL || 
    616                                         strcasestr(columnType, "date") != NULL || 
    617                                         strcasestr(columnType, "time") != NULL || 
    618                                         strcasestr(columnType, "text") != NULL || 
    619                                         strcasestr(columnType, "enum") != NULL || 
    620                                         strcasestr(columnType, "set") != NULL) 
    621                                 { 
    622                                         field->second = sql::FIELDTYPE_TEXT; 
    623                                 } 
    624                                 else 
    625                                 { 
    626                                         if (strcasestr(columnType, "blob") != NULL) 
    627                                         { 
    628                                                 field->second = sql::FIELDTYPE_BINARY; 
    629                                         } 
    630                                         else 
    631                                         { 
    632                                                 field->second = sql::FIELDTYPE_NUMERIC; 
    633                                         } 
    634                                 } 
    635                         } 
    636  
    637                         break; 
     626                                                if (strcasestr(columnType, "blob") != NULL) 
     627                                                { 
     628                                                        field->second = sql::FIELDTYPE_BINARY; 
     629                                                } 
     630                                                else 
     631                                                { 
     632                                                        field->second = sql::FIELDTYPE_NUMERIC; 
     633                                                } 
     634                                        } 
     635                                } 
     636 
     637                                break; 
    638638                } 
    639639        } 
     
    10781078                switch (sqlite3_step(sqliteResult)) 
    10791079                { 
    1080                 case SQLITE_BUSY: 
    1081  
    1082                         continue; 
    1083  
    1084                 case SQLITE_DONE: 
    1085  
    1086                         iterate = false; 
    1087  
    1088                         break; 
    1089  
    1090                 case SQLITE_ERROR: 
    1091  
    1092                         throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHFIELDSTOROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
    1093  
    1094                 case SQLITE_ROW: 
    1095  
    1096                         rowFieldsPart.clear(); 
    1097  
    1098                         for (i = 0; i < numFields; ++i) 
    1099                         { 
    1100                                 switch (sqlite3_column_type(sqliteResult, i)) 
    1101                                 { 
    1102                                 case SQLITE_INTEGER: 
    1103  
    1104                                         rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), tools::string::iToString(sqlite3_column_int(sqliteResult, i)))); 
    1105  
    1106                                         break; 
    1107  
    1108                                 case SQLITE_FLOAT: 
    1109  
    1110                                         rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), tools::string::dToString(sqlite3_column_double(sqliteResult, i)))); 
    1111  
    1112                                         break; 
    1113  
    1114                                 case SQLITE_TEXT: 
    1115  
    1116                                         rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), dodoString((const char *)sqlite3_column_text(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i)))); 
    1117  
    1118                                         break; 
    1119  
    1120                                 case SQLITE_BLOB: 
    1121  
    1122                                         rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), dodoString((const char *)sqlite3_column_blob(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i)))); 
    1123  
    1124                                         break; 
    1125  
    1126                                 case SQLITE_NULL: 
    1127                                 default: 
    1128  
    1129                                         rowFieldsPart.insert(make_pair(dodoString(sqlite3_column_name(sqliteResult, i)), statements[SQLCONSTRUCTOR_STATEMENT_NULL])); 
    1130  
    1131                                         break; 
    1132                                 } 
    1133                         } 
    1134  
    1135                         rowsFields.push_back(rowFieldsPart); 
    1136  
    1137                         break; 
     1080                        case SQLITE_BUSY: 
     1081 
     1082                                continue; 
     1083 
     1084                        case SQLITE_DONE: 
     1085 
     1086                                iterate = false; 
     1087 
     1088                                break; 
     1089 
     1090                        case SQLITE_ERROR: 
     1091 
     1092                                throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHFIELDSTOROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 
     1093 
     1094                        case SQLITE_ROW: 
     1095 
     1096                                rowFieldsPart.clear(); 
     1097 
     1098                                for (i = 0; i < numFields; ++i) 
     1099                                { 
     1100                                        switch (sqlite3_column_type(sqliteResult, i)) 
     1101                                        { 
     1102                                                case SQLITE_INTEGER: 
     1103 
     1104                                                        rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), tools::string::iToString(sqlite3_column_int(sqliteResult, i)))); 
     1105 
     1106                                                        break; 
     1107 
     1108                                                case SQLITE_FLOAT: 
     1109 
     1110                                                        rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), tools::string::dToString(sqlite3_column_double(sqliteResult, i)))); 
     1111 
     1112                                                        break; 
     1113 
     1114                                                case SQLITE_TEXT: 
     1115 
     1116                                                        rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), dodoString((const char *)sqlite3_column_text(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i)))); 
     1117 
     1118                                                        break; 
     1119 
     1120                                                case SQLITE_BLOB: 
     1121 
     1122                                                        rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), dodoString((const char *)sqlite3_column_blob(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i)))); 
     1123 
     1124                                                        break; 
     1125 
     1126                                                case SQLITE_NULL: 
     1127                                                default: 
     1128 
     1129                                                        rowFieldsPart.insert(make_pair(dodoString(sqlite3_column_name(sqliteResult, i)), statements[SQLCONSTRUCTOR_STATEMENT_NULL])); 
     1130 
     1131                                                        break; 
     1132                                        } 
     1133                                } 
     1134 
     1135                                rowsFields.push_back(rowFieldsPart); 
     1136 
     1137                                break; 
    11381138                } 
    11391139        } 
  • trunk/src/dataFormatJsonProcessor.cc

    r1162 r1166  
    4949        switch (root.valueDataType) 
    5050        { 
    51         case DATATYPE_STRING: 
    52         { 
    53                 dodoString jsonObject = "\""; 
    54                 dodoString stringValue = root.stringValue; 
    55                 tools::string::replace("\"", "\\\"", stringValue); 
    56                 jsonObject.append(stringValue); 
    57                 jsonObject.append("\""); 
    58  
    59                 return jsonObject; 
    60         } 
    61  
    62         case DATATYPE_OBJECT: 
    63         { 
    64                 dodoString jsonObject = "{"; 
    65  
    66                 dodoMap<dodoString, node, dodoMapStringCompare>::const_iterator i = root.objectValue.begin(), j = root.objectValue.end(); 
    67                 if (i != j) 
    68                 { 
    69                         for (--j; i != j; ++i) 
     51                case DATATYPE_STRING: 
     52                { 
     53                        dodoString jsonObject = "\""; 
     54                        dodoString stringValue = root.stringValue; 
     55                        tools::string::replace("\"", "\\\"", stringValue); 
     56                        jsonObject.append(stringValue); 
     57                        jsonObject.append("\""); 
     58 
     59                        return jsonObject; 
     60                } 
     61 
     62                case DATATYPE_OBJECT: 
     63                { 
     64                        dodoString jsonObject = "{"; 
     65 
     66                        dodoMap<dodoString, node, dodoMapStringCompare>::const_iterator i = root.objectValue.begin(), j = root.objectValue.end(); 
     67                        if (i != j) 
    7068                        { 
     69                                for (--j; i != j; ++i) 
     70                                { 
     71                                        jsonObject.append("\""); 
     72                                        jsonObject.append(i->first); 
     73                                        jsonObject.append("\":"); 
     74 
     75                                        jsonObject.append(make(i->second)); 
     76                                        jsonObject.append(","); 
     77                                } 
    7178                                jsonObject.append("\""); 
    7279                                jsonObject.append(i->first); 
     
    7481 
    7582                                jsonObject.append(make(i->second)); 
    76                                 jsonObject.append(","); 
    7783                        } 
    78                         jsonObject.append("\""); 
    79                         jsonObject.append(i->first); 
    80                         jsonObject.append("\":"); 
    81  
    82                         jsonObject.append(make(i->second)); 
    83                 } 
    84  
    85                 jsonObject.append("}"); 
    86  
    87                 return jsonObject; 
    88         } 
    89  
    90         case DATATYPE_ARRAY: 
    91         { 
    92                 dodoString jsonObject = "["; 
    93  
    94                 dodoArray<node>::const_iterator i = root.arrayValue.begin(), j = root.arrayValue.end(); 
    95                 if (i != j) 
    96                 { 
    97                         --j; 
    98                         for (; i != j; ++i) 
     84 
     85                        jsonObject.append("}"); 
     86 
     87                        return jsonObject; 
     88                } 
     89 
     90                case DATATYPE_ARRAY: 
     91                { 
     92                        dodoString jsonObject = "["; 
     93 
     94                        dodoArray<node>::const_iterator i = root.arrayValue.begin(), j = root.arrayValue.end(); 
     95                        if (i != j) 
    9996                        { 
     97                                --j; 
     98                                for (; i != j; ++i) 
     99                                { 
     100                                        jsonObject.append(make(*i)); 
     101                                        jsonObject.append(","); 
     102                                } 
    100103                                jsonObject.append(make(*i)); 
    101                                 jsonObject.append(","); 
    102104                        } 
    103                         jsonObject.append(make(*i)); 
    104                 } 
    105  
    106                 jsonObject.append("]"); 
    107  
    108                 return jsonObject; 
    109         } 
    110  
    111         case DATATYPE_NUMERIC: 
    112  
    113                 return tools::string::lToString(root.numericValue); 
    114  
    115         case DATATYPE_BOOLEAN: 
    116  
    117                 return root.booleanValue ? "true" : "false"; 
    118  
    119         case DATATYPE_NULL: 
    120         default: 
    121  
    122                 return "null"; 
     105 
     106                        jsonObject.append("]"); 
     107 
     108                        return jsonObject; 
     109                } 
     110 
     111                case DATATYPE_NUMERIC: 
     112 
     113                        return tools::string::lToString(root.numericValue); 
     114 
     115                case DATATYPE_BOOLEAN: 
     116 
     117                        return root.booleanValue ? "true" : "false"; 
     118 
     119                case DATATYPE_NULL: 
     120                default: 
     121 
     122                        return "null"; 
    123123        } 
    124124 
     
    144144                switch (root[i]) 
    145145                { 
    146                 case ' ': 
    147                 case '\r': 
    148                 case '\n': 
    149                 case '\t': 
    150  
    151                         break; 
    152  
    153                 case '[': 
    154  
    155                         if (initial) 
    156                         { 
    157                                 initial = false; 
    158                         } 
    159                         else 
    160                         { 
     146                        case ' ': 
     147                        case '\r': 
     148                        case '\n': 
     149                        case '\t': 
     150 
     151                                break; 
     152 
     153                        case '[': 
     154 
     155                                if (initial) 
     156                                { 
     157                                        initial = false; 
     158                                } 
     159                                else 
     160                                { 
     161                                        i = processValue(subNode, root, i); 
     162 
     163                                        jnode.push_back(subNode); 
     164                                } 
     165 
     166                                break; 
     167 
     168                        case ']': 
     169 
     170                                return i; 
     171 
     172                        case ',': 
     173 
     174                                break; 
     175 
     176                        default: 
     177 
    161178                                i = processValue(subNode, root, i); 
    162179 
    163180                                jnode.push_back(subNode); 
    164                         } 
    165  
    166                         break; 
    167  
    168                 case ']': 
    169  
    170                         return i; 
    171  
    172                 case ',': 
    173  
    174                         break; 
    175  
    176                 default: 
    177  
    178                         i = processValue(subNode, root, i); 
    179  
    180                         jnode.push_back(subNode); 
    181181                } 
    182182        } 
     
    199199                switch (root[i]) 
    200200                { 
    201                 case ' ': 
    202                 case '\r': 
    203                 case '\n': 
    204                 case '\t': 
    205  
    206                         break; 
    207  
    208                 case '"': 
    209  
    210                         node.valueDataType = DATATYPE_STRING; 
    211  
    212                         return processString(node.stringValue, root, i); 
    213  
    214                 case '{': 
    215  
    216                         node.valueDataType = DATATYPE_OBJECT; 
    217  
    218                         return processObject(node.objectValue, root, i); 
    219  
    220                 case '[': 
    221  
    222                         node.valueDataType = DATATYPE_ARRAY; 
    223  
    224                         return processArray(node.arrayValue, root, i); 
    225  
    226                 case 't': 
    227                 case 'f': 
    228  
    229                         node.valueDataType = DATATYPE_BOOLEAN; 
    230  
    231                         return processBoolean(node.booleanValue, root, i); 
    232  
    233                 case 'n': 
    234  
    235                         node.valueDataType = DATATYPE_NULL; 
    236  
    237                         return processNull(root, i); 
    238  
    239                 default: 
    240  
    241                         node.valueDataType = DATATYPE_NUMERIC; 
    242  
    243                         return processNumeric(node.numericValue, root, i); 
     201                        case ' ': 
     202                        case '\r': 
     203                        case '\n': 
     204                        case '\t': 
     205 
     206                                break; 
     207 
     208                        case '"': 
     209 
     210                                node.valueDataType = DATATYPE_STRING; 
     211 
     212                                return processString(node.stringValue, root, i); 
     213 
     214                        case '{': 
     215 
     216                                node.valueDataType = DATATYPE_OBJECT; 
     217 
     218                                return processObject(node.objectValue, root, i); 
     219 
     220                        case '[': 
     221 
     222                                node.valueDataType = DATATYPE_ARRAY; 
     223 
     224                                return processArray(node.arrayValue, root, i); 
     225 
     226                        case 't': 
     227                        case 'f': 
     228 
     229                                node.valueDataType = DATATYPE_BOOLEAN; 
     230 
     231                                return processBoolean(node.booleanValue, root, i); 
     232 
     233                        case 'n': 
     234 
     235                                node.valueDataType = DATATYPE_NULL; 
     236 
     237                                return processNull(root, i); 
     238 
     239                        default: 
     240 
     241                                node.valueDataType = DATATYPE_NUMERIC; 
     242 
     243                                return processNumeric(node.numericValue, root, i); 
    244244                } 
    245245        } 
     
    318318                switch (root[i]) 
    319319                { 
    320                 case ' ': 
    321                 case '\r': 
    322                 case '\n': 
    323                 case '\t': 
    324  
    325                         break; 
    326  
    327                 case '1': 
    328                 case '2': 
    329                 case '3': 
    330                 case '4': 
    331                 case '5': 
    332                 case '6': 
    333                 case '7': 
    334                 case '8': 
    335                 case '9': 
    336                 case '0': 
    337                 case '+': 
    338                 case '-': 
    339                 case 'e': 
    340                 case 'E': 
    341  
    342                         numeric.append(1, root[i]); 
    343  
    344                         break; 
    345  
    346                 case ',': 
    347                 case ']': 
    348                 case '}': 
    349  
    350                         node = tools::string::stringToL(numeric); 
    351  
    352                         return i - 1; 
    353  
    354                 default: 
    355  
    356                         throw exception::basic(exception::ERRMODULE_DATAFORMATJSONPROCESSOR, PROCESSOREX_PROCESSNUMERIC, exception::ERRNO_LIBDODO, PROCESSOREX_MALFORMEDJSONNUMERIC, DATAFORMATJSONPROCESSOREX_MALFORMEDJSONNUMERIC_STR, __LINE__, __FILE__); 
     320                        case ' ': 
     321                        case '\r': 
     322                        case '\n': 
     323                        case '\t': 
     324 
     325                                break; 
     326 
     327                        case '1': 
     328                        case '2': 
     329                        case '3': 
     330                        case '4': 
     331                        case '5': 
     332                        case '6': 
     333                        case '7': 
     334                        case '8': 
     335                        case '9': 
     336                        case '0': 
     337                        case '+': 
     338                        case '-': 
     339                        case 'e': 
     340                        case 'E': 
     341 
     342                                numeric.append(1, root[i]); 
     343 
     344                                break; 
     345 
     346                        case ',': 
     347                        case ']': 
     348                        case '}': 
     349 
     350                                node = tools::string::stringToL(numeric); 
     351 
     352                                return i - 1; 
     353 
     354                        default: 
     355 
     356                                throw exception::basic(exception::ERRMODULE_DATAFORMATJSONPROCESSOR, PROCESSOREX_PROCESSNUMERIC, exception::ERRNO_LIBDODO, PROCESSOREX_MALFORMEDJSONNUMERIC, DATAFORMATJSONPROCESSOREX_MALFORMEDJSONNUMERIC_STR, __LINE__, __FILE__); 
    357357                } 
    358358        } 
     
    381381                switch (root[i]) 
    382382                { 
    383                 case ' ': 
    384                 case '\r': 
    385                 case '\n': 
    386                 case '\t': 
    387                 case ':': 
    388                 case ',': 
    389  
    390                         break; 
    391  
    392                 case '{': 
    393  
    394                         if (state == JSON_STATE_OBJECT_INITIAL) 
    395                         { 
    396                                 state = JSON_STATE_OBJECT_OBJECTNAME; 
    397  
    398                                 break; 
    399                         } 
    400                         else 
    401                         { 
     383                        case ' ': 
     384                        case '\r': 
     385                        case '\n': 
     386                        case '\t': 
     387                        case ':': 
     388                        case ',': 
     389 
     390                                break; 
     391 
     392                        case '{': 
     393 
     394                                if (state == JSON_STATE_OBJECT_INITIAL) 
     395                                { 
     396                                        state = JSON_STATE_OBJECT_OBJECTNAME; 
     397 
     398                                        break; 
     399                                } 
     400                                else 
     401                                { 
     402                                        if (state == JSON_STATE_OBJECT_OBJECTVALUE) 
     403                                        { 
     404                                                subNodeValue.clear(); 
     405 
     406                                                subNodeValue.valueDataType = DATATYPE_OBJECT; 
     407 
     408                                                i = processObject(subNodeValue.objectValue, root, i); 
     409                                                jnode.insert(make_pair(subNodeName, subNodeValue)); 
     410 
     411                                                state = JSON_STATE_OBJECT_OBJECTNAME; 
     412 
     413                                                break; 
     414                                        } 
     415                                } 
     416 
     417                        case '}': 
     418 
     419                                return i; 
     420 
     421                        case '"': 
     422 
     423                                if (state == JSON_STATE_OBJECT_OBJECTNAME) 
     424                                { 
     425                                        i = processString(subNodeName, root, i); 
     426 
     427                                        state = JSON_STATE_OBJECT_OBJECTVALUE; 
     428 
     429                                        break; 
     430                                } 
     431                                else 
     432                                { 
     433                                        if (state == JSON_STATE_OBJECT_OBJECTVALUE) 
     434                                        { 
     435                                                subNodeValue.clear(); 
     436 
     437                                                subNodeValue.valueDataType = DATATYPE_STRING; 
     438 
     439                                                i = processString(subNodeValue.stringValue, root, i); 
     440                                                jnode.insert(make_pair(subNodeName, subNodeValue)); 
     441 
     442                                                state = JSON_STATE_OBJECT_OBJECTNAME; 
     443 
     444                                                break; 
     445                                        } 
     446                                } 
     447 
     448                        default: 
     449 
    402450                                if (state == JSON_STATE_OBJECT_OBJECTVALUE) 
    403451                                { 
    404                                         subNodeValue.clear(); 
    405  
    406                                         subNodeValue.valueDataType = DATATYPE_OBJECT; 
    407  
    408                                         i = processObject(subNodeValue.objectValue, root, i); 
     452                                        i = processValue(subNodeValue, root, i); 
    409453                                        jnode.insert(make_pair(subNodeName, subNodeValue)); 
    410454 
    411455                                        state = JSON_STATE_OBJECT_OBJECTNAME; 
    412  
    413                                         break; 
    414                                 } 
    415                         } 
    416  
    417                 case '}': 
    418  
    419                         return i; 
    420  
    421                 case '"': 
    422  
    423                         if (state == JSON_STATE_OBJECT_OBJECTNAME) 
    424                         { 
    425                                 i = processString(subNodeName, root, i); 
    426  
    427                                 state = JSON_STATE_OBJECT_OBJECTVALUE; 
    428  
    429                                 break; 
    430                         } 
    431                         else 
    432                         { 
    433                                 if (state == JSON_STATE_OBJECT_OBJECTVALUE) 
    434                                 { 
    435                                         subNodeValue.clear(); 
    436  
    437                                         subNodeValue.valueDataType = DATATYPE_STRING; 
    438  
    439                                         i = processString(subNodeValue.stringValue, root, i); 
    440                                         jnode.insert(make_pair(subNodeName, subNodeValue)); 
    441  
    442                                         state = JSON_STATE_OBJECT_OBJECTNAME; 
    443  
    444                                         break; 
    445                                 } 
    446                         } 
    447  
    448                 default: 
    449  
    450                         if (state == JSON_STATE_OBJECT_OBJECTVALUE) 
    451                         { 
    452                                 i = processValue(subNodeValue, root, i); 
    453                                 jnode.insert(make_pair(subNodeName, subNodeValue)); 
    454  
    455                                 state = JSON_STATE_OBJECT_OBJECTNAME; 
    456                         } 
     456                                } 
    457457                } 
    458458        } 
     
    543543                switch (root[i]) 
    544544                { 
    545                 case '\\': 
    546  
    547                         if (!escape) 
    548                         { 
    549                                 escape = true; 
    550  
    551                                 break; 
    552                         } 
    553  
    554                 case '"': 
    555  
    556                         if (!escape) 
    557                         { 
    558                                 if (initial) 
    559                                 { 
    560                                         initial = false; 
     545                        case '\\': 
     546 
     547                                if (!escape) 
     548                                { 
     549                                        escape = true; 
    561550 
    562551                                        break; 
    563552                                } 
     553 
     554                        case '"': 
     555 
     556                                if (!escape) 
     557                                { 
     558                                        if (initial) 
     559                                        { 
     560                                                initial = false; 
     561 
     562                                                break; 
     563                                        } 
     564                                        else 
     565                                        { 
     566                                                return i; 
     567                                        } 
     568                                } 
     569 
     570                        default: 
     571 
     572                                if (escape) 
     573                                { 
     574                                        escape = false; 
     575 
     576                                        jnode.append(1, '\\'); 
     577                                        jnode.append(1, root[i]); 
     578                                } 
    564579                                else 
    565580                                { 
    566                                         return i; 
    567                                 } 
    568                         } 
    569  
    570                 default: 
    571  
    572                         if (escape) 
    573                         { 
    574                                 escape = false; 
    575  
    576                                 jnode.append(1, '\\'); 
    577                                 jnode.append(1, root[i]); 
    578                         } 
    579                         else 
    580                         { 
    581                                 jnode.append(1, root[i]); 
    582                         } 
     581                                        jnode.append(1, root[i]); 
     582                                } 
    583583                } 
    584584        } 
  • trunk/src/dataTplProcessor.cc

    r1162 r1166  
    356356                switch (temp[0]) 
    357357                { 
    358                 case 'p': 
    359  
    360                         k = temp.find(statements[PROCESSOR_STATEMENT_PRINT]); 
    361                         if (k == 0) 
    362                         { 
    363                                 j = _print(j, dodoString(temp.data() + 5, temp.size() - 5), tpl, path); 
    364                         } 
    365                         else 
    366                         { 
     358                        case 'p': 
     359 
     360                                k = temp.find(statements[PROCESSOR_STATEMENT_PRINT]); 
     361                                if (k == 0) 
     362                                { 
     363                                        j = _print(j, dodoString(temp.data() + 5, temp.size() - 5), tpl, path); 
     364                                } 
     365                                else 
     366                                { 
     367                                        keywordNotFound = true; 
     368                                } 
     369 
     370                                break; 
     371 
     372                        case 'i': 
     373 
     374                                k = temp.find(statements[PROCESSOR_STATEMENT_OPEN_IF]); 
     375                                if (k == 0) 
     376                                { 
     377                                        ++namespaceDeepness; 
     378 
     379                                        j = _if(buffer, j, dodoString(temp.data() + 2, temp.size() - 2), tpl, path); 
     380 
     381                                        cleanNamespace(); 
     382 
     383                                        --namespaceDeepness; 
     384                                } 
     385                                else 
     386                                { 
     387                                        k = temp.find(statements[PROCESSOR_STATEMENT_INCLUDE]); 
     388                                        if (k == 0) 
     389                                        { 
     390                                                j = _include(j, dodoString(temp.data() + 8, temp.size() - 8), tpl, path); 
     391                                        } 
     392                                        else 
     393                                        { 
     394                                                keywordNotFound = true; 
     395                                        } 
     396                                } 
     397 
     398                                break; 
     399 
     400                        case 'f': 
     401 
     402                                k = temp.find(statements[PROCESSOR_STATEMENT_OPEN_FOR]); 
     403                                if (k == 0) 
     404                                { 
     405                                        ++loopDeepness; 
     406                                        ++namespaceDeepness; 
     407 
     408                                        j = _for(buffer, j, dodoString(temp.data() + 3, temp.size() - 3), tpl, path); 
     409 
     410                                        cleanNamespace(); 
     411 
     412                                        --namespaceDeepness; 
     413                                        --loopDeepness; 
     414                                } 
     415                                else 
     416                                { 
     417                                        keywordNotFound = true; 
     418                                } 
     419 
     420                                break; 
     421 
     422                        case 'b': 
     423 
     424                                k = temp.find(statements[PROCESSOR_STATEMENT_BREAK]); 
     425                                if (k == 0) 
     426                                { 
     427                                        if (_break(j, dodoString(temp.data() + 5, temp.size() - 5), path)) 
     428                                        { 
     429                                                breakLoop = true; 
     430                                        } 
     431                                } 
     432                                else 
     433                                { 
     434                                        keywordNotFound = true; 
     435                                } 
     436 
     437                                break; 
     438 
     439                        case 'c': 
     440 
     441                                k = temp.find(statements[PROCESSOR_STATEMENT_CONT]); 
     442                                if (k == 0) 
     443                                { 
     444                                        if (loopDeepness > 0) 
     445                                        { 
     446                                                continueFlag = true; 
     447 
     448                                                breakLoop = true; 
     449                                        } 
     450                                } 
     451                                else 
     452                                { 
     453                                        keywordNotFound = true; 
     454                                } 
     455 
     456                                break; 
     457 
     458                        case 'a': 
     459 
     460                                k = temp.find(statements[PROCESSOR_STATEMENT_ASSIGN]); 
     461                                if (k == 0) 
     462                                { 
     463                                        j = _assign(j, dodoString(temp.data() + 6, temp.size() - 6), path); 
     464                                } 
     465                                else 
     466                                { 
     467                                        keywordNotFound = true; 
     468                                } 
     469 
     470                                break; 
     471 
     472                        case 'n': 
     473 
     474                                k = temp.find(statements[PROCESSOR_STATEMENT_OPEN_NS]); 
     475                                if (k == 0) 
     476                                { 
     477                                        ++namespaceDeepness; 
     478 
     479                                        j = _ns(buffer, j, tpl, path); 
     480 
     481                                        cleanNamespace(); 
     482 
     483                                        --namespaceDeepness; 
     484                                }