Diff for /sql/odbc/parser3odbc.C between versions 1.36 and 1.37

version 1.36, 2008/07/08 10:53:32 version 1.37, 2010/10/27 22:48:50
Line 210  public: Line 210  public:
                 return true;                  return true;
         }          }
   
         const char* quote(void *aconnection, const char *from, unsigned int length){          // charset here is services.request_charset(), not connection.client_charset
           // thus we can't use the sql server quoting support
           const char* quote(void *aconnection, const char *str, unsigned int length) 
           {
                   const char* from;
                   const char* from_end=str+length;
   
                   size_t quoted=0;
   
                   for(from=str; from<from_end; from++){
                           if(*from=='\'')
                                   quoted++;
                   }
   
                   if(!quoted)
                           return str;
   
                 Connection& connection=*static_cast<Connection*>(aconnection);                  Connection& connection=*static_cast<Connection*>(aconnection);
                 char *result=(char*)connection.services->malloc_atomic(length*2+1);                  char *result=(char*)connection.services->malloc_atomic(length + quoted + 1);
                 char *to=result;                  char *to = result;
                 while(length--){  
                         if(*from=='\'') { // ' -> ''                  for(from=str; from<from_end; from++){
                                 *to++='\'';                          if(*from=='\'')
                         }                                  *to++= '\''; // ' -> ''
                         *to++=*from++;                          *to++=*from;
                 }                  }
                   
                 *to=0;                  *to=0;
                 return result;                  return result;
         }          }

Removed from v.1.36  
changed lines
  Added in v.1.37


E-mail: