--- ZSQLExtend/ZSQLExtend.py 2010/09/22 08:57:26 1.136 +++ ZSQLExtend/ZSQLExtend.py 2011/02/14 22:00:50 1.138 @@ -369,7 +369,7 @@ class ZSQLExtendFolder(Folder,Persistent lc_names=True,keep_fields=False,ascii_db=False,replace=False,backup=False, debug=False,log_to_response=False, redirect_url=None,RESPONSE=None): - ''' + """ Import FileMaker XML file (FMPXMLRESULT format) into the table. @param dsn: database connection string @param table: name of the table the xml shall be imported into (may be comma-separated list) @@ -384,7 +384,7 @@ class ZSQLExtendFolder(Folder,Persistent @param backup: (optional) create backup of old table (breaks indices) @param RESPONSE: (optional) @param redirect_url: (optional) url for redirecting after the upload is done - ''' + """ tfilehd,filename=tempfile.mkstemp() tfile=os.fdopen(tfilehd,'w') @@ -506,7 +506,7 @@ class ZSQLExtendFolder(Folder,Persistent def URLquote(self,txt): - """urlquote" + """urlquote @param txt: text der urlgequoted werden soll. """ return urllib.quote(txt) @@ -930,7 +930,7 @@ class ZSQLExtendFolder(Folder,Persistent def ZSQLInlineSearch(self,storename=None,args=None,**argv): """inlinesearch""" - + #logging.debug("ZSQLInlineSearch args=%s argv=%s"%(args,argv)) qs=[] if storename: """store""" @@ -950,9 +950,11 @@ class ZSQLExtendFolder(Folder,Persistent if type(argTmp[a]) is ListType: # ein parameter zweimal value="" #TODO find a better solution, currently only the last non empty entry is used. - for x in argTmp[a]: - if x: - value=x + #for x in argTmp[a]: + # if x: + # value=x + # version: join with spaces (makes sense with checkbox and -op=all) + value = " ".join(argTmp[a]) else: try: value=str(argTmp[a]) @@ -960,7 +962,7 @@ class ZSQLExtendFolder(Folder,Persistent value=utf8ify(argTmp[a]) qs.append(aFiltered+"="+urllib.quote(value)) - logging.debug("InlineSearch:"+string.join(qs,",")) + #logging.debug("InlineSearch:"+string.join(qs,",")) #return [] @@ -985,7 +987,19 @@ class ZSQLExtendFolder(Folder,Persistent except: logger("ZSQLResetConnection",logging.ERROR, '%s %s'%sys.exc_info()[:2]) + def ZSQLSimpleSearch(self,query=None,max_rows=1000000): + """new simple search""" + logging.debug("new ZSQLSimpleSearch X %s"%query) + # get Connection instance + con = self.getConnectionObj() + # call to get db object + dbc = con() + res = dbc.query(query, max_rows=max_rows) + # return result set as Result object with Brains + return Results(res) + + def oldZSQLSimpleSearch(self,query=None,max_rows=1000000): """simple search""" logging.error("ZSQLSimpleSearch X %s"%query) #print query @@ -1214,7 +1228,7 @@ class ZSQLExtendFolder(Folder,Persistent """search in database""" def delEmpty(list): - """"loesche leere elemente aus der liste""" + """loesche leere elemente aus der liste""" ret=[] for x in list: splitted=x.split("=") @@ -1348,7 +1362,7 @@ class ZSQLExtendFolder(Folder,Persistent def parseQueryString(self,qs,iCT,storemax="no",select=None,nostore=None,storename="foundCount",tableExt=None,NoQuery=None,NoLimit=None,restrictField=None,restrictConnect=None,filter=None): """analysieren den QueryString""" - + logging.debug("parseQueryString qs=%s"%qs) #setzte generische werte @@ -1504,6 +1518,7 @@ class ZSQLExtendFolder(Folder,Persistent op=opfields[name] else: op="ct" + namealt=name name="LOWER("+punktsplit[1]+")" value=value.lower()