Diff for /ZSQLExtend/ZSQLExtend.py between versions 1.35 and 1.36

version 1.35, 2004/09/27 20:31:40 version 1.36, 2004/09/27 20:43:58
Line 335  class ZSQLExtendFolder(Folder,Persistent Line 335  class ZSQLExtendFolder(Folder,Persistent
                 table=urllib.unquote(value)                  table=urllib.unquote(value)
             elif name=="-identify":              elif name=="-identify":
                 identify=urllib.unquote(value)                  identify=urllib.unquote(value)
                 identify=identify.split("=")[0]+"="+libpq.PgQuoteString(identify.split("=")[1])                  identify=identify.split("=")[0]+"="+sql_quote(identify.split("=")[1])
             elif name=="-format":              elif name=="-format":
                 format=urllib.unquote(value)                  format=urllib.unquote(value)
             elif (not name[0]=="-") and (not len(value)==0):              elif (not name[0]=="-") and (not len(value)==0):
                 changeList.append("\""+name+"\"="+libpq.PgQuoteString(urllib.unquote(value)))                  changeList.append("\""+name+"\"="+sql_quote(urllib.unquote(value)))
         changeString=string.join(changeList,",")          changeString=string.join(changeList,",")
         queryString="UPDATE %s SET %s WHERE %s"%(table,changeString,identify)          queryString="UPDATE %s SET %s WHERE %s"%(table,changeString,identify)
         self.ZSQLSimpleSearch(queryString)          self.ZSQLSimpleSearch(queryString)
         return self.REQUEST.RESPONSE.redirect(format)          return self.REQUEST.RESPONSE.redirect(format)
   
     def ZSQLChange_old(self):      def ZSQLChange_old(self):
         """Ändern von Einträgen"""          """change entries"""
         qs=self.REQUEST['QUERY_STRING']          qs=self.REQUEST['QUERY_STRING']
         #print "CHANGE QS",self.REQUEST          #print "CHANGE QS",self.REQUEST
         #return self.REQUEST          #return self.REQUEST
Line 360  class ZSQLExtendFolder(Folder,Persistent Line 360  class ZSQLExtendFolder(Folder,Persistent
                 table=urllib.unquote(value)                  table=urllib.unquote(value)
             elif name=="-identify":              elif name=="-identify":
                 identify=urllib.unquote(value)                  identify=urllib.unquote(value)
                 identify=identify.split("=")[0]+"="+libpq.PgQuoteString(identify.split("=")[1])                  identify=identify.split("=")[0]+"="+sql_quote(identify.split("=")[1])
             elif name=="-format":              elif name=="-format":
                 format=urllib.unquote(value)                  format=urllib.unquote(value)
             elif (not name[0]=="-") and (not len(value)==0):              elif (not name[0]=="-") and (not len(value)==0):
                 changeList.append("\""+name+"\"="+libpq.PgQuoteString(urllib.unquote(value)))                  changeList.append("\""+name+"\"="+sql_quote(urllib.unquote(value)))
         changeString=string.join(changeList,",")          changeString=string.join(changeList,",")
         queryString="UPDATE %s SET %s WHERE %s"%(table,changeString,identify)          queryString="UPDATE %s SET %s WHERE %s"%(table,changeString,identify)
         self.ZSQLSimpleSearch(queryString)          self.ZSQLSimpleSearch(queryString)
Line 564  class ZSQLExtendFolder(Folder,Persistent Line 564  class ZSQLExtendFolder(Folder,Persistent
             except:              except:
                 value=""                  value=""
                                   
             #value=libpq.PgQuoteString(value)              #value=sql_quote(value)
                           
                           
             if name==iCT+"lop":              if name==iCT+"lop":
Line 614  class ZSQLExtendFolder(Folder,Persistent Line 614  class ZSQLExtendFolder(Folder,Persistent
                 namealt=name                  namealt=name
                 name="LOWER("+name+")"                      name="LOWER("+name+")"    
                 if op=="ct":                  if op=="ct":
                     tmp=(name+" LIKE "+libpq.PgQuoteString("%"+value+"%"))                      tmp=(name+" LIKE "+sql_quote("%"+value+"%"))
                 elif op=="gt":                  elif op=="gt":
                     tmp=(name+">"+libpq.PgQuoteString(value))                      tmp=(name+">"+sql_quote(value))
                 elif op=="lt":                  elif op=="lt":
                     tmp=(name+"<"+libpq.PgQuoteString(value))                      tmp=(name+"<"+sql_quote(value))
                 elif op=="eq":                  elif op=="eq":
                     tmp=(name+"="+libpq.PgQuoteString(value))                      tmp=(name+"="+sql_quote(value))
                 elif op=="bw":                  elif op=="bw":
                     tmp=(name+" LIKE "+libpq.PgQuoteString(value+"%"))                      tmp=(name+" LIKE "+sql_quote(value+"%"))
                 elif op=="ew":                  elif op=="ew":
                     tmp=(name+" LIKE "+libpq.PgQuoteString("%"+value))                      tmp=(name+" LIKE "+sql_quote("%"+value))
                 elif op=="all":                  elif op=="all":
                     tmps=[]                      tmps=[]
                     for word in value.split(" "):                      for word in value.split(" "):
                         tmps.append(name+" LIKE "+libpq.PgQuoteString("%"+word+"%"))                          tmps.append(name+" LIKE "+sql_quote("%"+word+"%"))
                                                   
                     tmp=string.join(tmps,' AND ')                      tmp=string.join(tmps,' AND ')
                                           
Line 652  class ZSQLExtendFolder(Folder,Persistent Line 652  class ZSQLExtendFolder(Folder,Persistent
 ##                 op="ct"  ##                 op="ct"
 ##             name="LOWER("+name+")"      ##             name="LOWER("+name+")"    
 ##             if op=="ct":  ##             if op=="ct":
 ##                 whereList.append(name+" LIKE "+libpq.PgQuoteString("%"+value+"%"))  ##                 whereList.append(name+" LIKE "+sql_quote("%"+value+"%"))
 ##             elif op=="gt":  ##             elif op=="gt":
 ##                 whereList.append(name+">"+libpq.PgQuoteString(value))  ##                 whereList.append(name+">"+sql_quote(value))
 ##             elif op=="lt":  ##             elif op=="lt":
 ##                 whereList.append(name+"<"+libpq.PgQuoteString(value))  ##                 whereList.append(name+"<"+sql_quote(value))
 ##             elif op=="eq":  ##             elif op=="eq":
 ##                 whereList.append(name+"="+libpq.PgQuoteString(value))  ##                 whereList.append(name+"="+sql_quote(value))
 ##             elif op=="bw":  ##             elif op=="bw":
 ##                 whereList.append(name+" LIKE "+libpq.PgQuoteString(value+"%"))  ##                 whereList.append(name+" LIKE "+sql_quote(value+"%"))
 ##             elif op=="ew":  ##             elif op=="ew":
 ##                 whereList.append(name+" LIKE "+libpq.PgQuoteString("%"+value))  ##                 whereList.append(name+" LIKE "+sql_quote("%"+value))
 ##             op="ct"  ##             op="ct"
                           
 ##             #except:  ##             #except:

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


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>