--- ZSQLExtend/ZSQLExtend.py 2005/11/23 17:41:28 1.74 +++ ZSQLExtend/ZSQLExtend.py 2005/12/22 20:33:11 1.76 @@ -67,6 +67,11 @@ class ZSQLExtendFolder(Folder,Persistent """Folder""" meta_type="ZSQLExtendFolder" + def ZSQLQuote(self,str): + """quote str for sql""" + return sql_quote(str) + + def importXMLFile(self,table,containerTagName,file,identify=None,RESPONSE=None): #TODO: finish importXMLFile ''' @@ -429,9 +434,10 @@ class ZSQLExtendFolder(Folder,Persistent def ZSQLSimpleSearch(self,query=None,max_rows=1000000): """simple search""" - + if not query: query=self.query + if (hasattr(self,"_v_searchSQL") and (self._v_searchSQL == None)) or (not hasattr(self,"_v_searchSQL")): @@ -439,9 +445,9 @@ class ZSQLExtendFolder(Folder,Persistent self._v_searchSQL.max_rows_=max_rows try: - return self._v_searchSQL.__call__(var=query) except : + if sys.exc_info()[0]=="Database Error": try: self.getConnectionObj().manage_open_connection() @@ -449,10 +455,12 @@ class ZSQLExtendFolder(Folder,Persistent zLOG.LOG("ZSQLSimpleSearch",zLOG.ERROR, '%s %s'%sys.exc_info()[:2]) else: try: + self._v_searchSQL.max_rows_=max_rows return self._v_searchSQL.__call__(var=query) except : + if sys.exc_info()[0]=="Database Error": try: self.getConnectionObj().manage_open_connection() @@ -579,11 +587,13 @@ class ZSQLExtendFolder(Folder,Persistent elif name=="-format": format=urllib.unquote(value) elif (not (name[0]=="-" or name[0]=="_")) and (not len(value)==0): + changeList.append("\""+name+"\"="+sql_quote(urllib.unquote(value))) changeString=string.join(changeList,",") + queryString="UPDATE %s SET %s WHERE %s"%(table,changeString,identify) - + self.ZSQLSimpleSearch(queryString) @@ -1567,7 +1577,7 @@ class ZSQLBibliography(Folder,ZSQLExtend host_port = self.REQUEST['SERVER_PORT'] fix_host = None if http_host and http_host.rfind(host_port) == -1: - print "HTTP_HOST needs fixing!" + #print "HTTP_HOST needs fixing!" fix_host = http_host + ":" + host_port ret="""