Diff for /sql/pgsql/parser3pgsql.C between versions 1.26 and 1.28

version 1.26, 2007/01/26 10:10:32 version 1.28, 2007/10/25 17:08:41
Line 5 Line 5
   
         Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)          Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
   
         2001.07.30 using PgSQL 7.1.2          2007.10.25 using PgSQL 8.1.5
 */  */
 static const char *RCSId="$Id$";   static const char *RCSId="$Id$"; 
   
Line 167  public: Line 167  public:
                         }                          }
                 }                  }
   
                 if(connection.cstrClientCharset && cstrBackwardCompAskServerToTranscode)                  // if(connection.cstrClientCharset && cstrBackwardCompAskServerToTranscode)
                         services._throw("use 'ClientCharset' option only, "                  //      services._throw("use 'ClientCharset' option only, "
                                 "'charset' option is obsolete and should not be used with new 'ClientCharset' option");                  //              "'charset' option is obsolete and should not be used with new 'ClientCharset' option");
   
                 if(cstrBackwardCompAskServerToTranscode) {                  if(cstrBackwardCompAskServerToTranscode) {
                         // set CLIENT_ENCODING                          // set CLIENT_ENCODING
Line 237  public: Line 237  public:
                         //services._throw("bind variables not supported (yet)");                          //services._throw("bind variables not supported (yet)");
                         int binds_size=sizeof(char) * placeholders_count;                          int binds_size=sizeof(char) * placeholders_count;
                         paramValues = static_cast<const char**>(services.malloc_atomic(binds_size));                          paramValues = static_cast<const char**>(services.malloc_atomic(binds_size));
                         for(size_t i=0; i<placeholders_count; ++i) {                          bind_parameters(placeholders_count, placeholders, paramValues, connection);
                                 Placeholder& ph=placeholders[i];  
                                 size_t value_length;  
                                 if(cstrClientCharset) {  
                                         size_t name_length;  
                                         services.transcode(ph.name, strlen(ph.name),  
                                                 ph.name, name_length,  
                                                 services.request_charset(),  
                                                 cstrClientCharset);  
   
                                         if(ph.value){  
                                                 services.transcode(ph.value, strlen(ph.value),  
                                                         ph.value, value_length,  
                                                         services.request_charset(),  
                                                         cstrClientCharset);  
                                         }  
                                 } else {  
                                         value_length=ph.value? strlen(ph.value): 0;  
                                 }  
                                 if( atoi(ph.name) <= 0 || atoi(ph.name) > placeholders_count) {  
                                         services._throw("bad bind parameter key");  
                                 }  
                                 paramValues[atoi(ph.name)-1] = ph.value;  
                         }  
                 }                  }
   
                 // transcode from $request:charset to connect-string?client_charset                  // transcode from $request:charset to connect-string?client_charset
Line 399  cleanup: Line 376  cleanup:
   
 private: // private funcs  private: // private funcs
   
           void bind_parameters(
                   size_t placeholders_count, 
                   Placeholder* placeholders, 
                   const char** paramValues,
                   Connection& connection
                   ) {
                   for(size_t i=0; i<placeholders_count; i++) {
                           Placeholder& ph=placeholders[i];
                           size_t value_length;
                           if(connection.cstrClientCharset) {
                                   size_t name_length;
                                   connection.services->transcode(ph.name, strlen(ph.name),
                                           ph.name, name_length,
                                           connection.services->request_charset(),
                                           connection.cstrClientCharset);
   
                                   if(ph.value) {
                                           connection.services->transcode(ph.value, strlen(ph.value),
                                                   ph.value, value_length,
                                                   connection.services->request_charset(),
                                                   connection.cstrClientCharset);
                                   }
                           }
                           if( atoi(ph.name) <= 0 || atoi(ph.name) > placeholders_count) {
                                   connection.services->_throw("bad bind parameter key");
                           }
                           paramValues[atoi(ph.name)-1] = ph.value;
                   }
           }
           
           
         void execute_transaction_cmd(void *aconnection, const char *query) {          void execute_transaction_cmd(void *aconnection, const char *query) {
                 if(isDefaultTransaction)                  if(isDefaultTransaction)
                 {                  {

Removed from v.1.26  
changed lines
  Added in v.1.28


E-mail: