On Sun, Apr 22, 2007 at 09:27:02PM +0400, Oleg Broytmann wrote: > On Sun, Apr 22, 2007 at 02:05:36PM -0300, Jorge Godoy wrote: > > model.VResultadoResumo.q.nomePacienteNormalizado.startswith( > > func.f_v_texto(nome_paciente))) > [skip] > > ((neolab.v_resultados_resumo.nome_paciente_normalizado) LIKE > > ('_v_texto('jo'%'))) ORDER BY id > > ================================================================================ > > > > It is missing the 'f' in 'f_v_texto' and misses one closing parenthesis. > > Also, I don't know why it is quoting the function name. > > This is the result of sqlbuilder._LikeQuoted.__sqlrepr__() that > incorrectly processes its expression. Instead of removing quotes it removes > the first letter and adds excessive quotes.
Jorge, can you replace sqlbuilder._LikeQuoted.__sqlrepr__() with the following and test if works for you? def __sqlrepr__(self, db): s = self.expr if isinstance(s, SQLExpression): values = [] if self.prefix: values.append(sqlrepr(self.prefix, db)) s = _quote_percent(sqlrepr(s, db), db) values.append(s) if self.postfix: values.append(sqlrepr(self.postfix, db)) if db == "mysql": return "CONCAT(%s)" % ", ".join(values) else: return " || ".join(values) else: # assuming s is a string s = _quote_percent(s, db) return "'%s%s%s'" % (self.prefix, s, self.postfix) def _quote_percent(s, db): if db in ('postgres', 'mysql'): s = s.replace('%', '\\%') else: s = s.replace('%', '%%') return s Oleg. -- Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss