From: Jorge G. <jg...@gm...> - 2007-04-23 22:13:39
|
Oleg Broytmann <ph...@ph...> writes: > On Mon, Apr 23, 2007 at 04:13:57PM -0300, Jorge Godoy wrote: >> > Jorge, can you replace sqlbuilder._LikeQuoted.__sqlrepr__() with the >> > following and test if works for you? >> >> I'll do that tonight. I'm working at my client's office now and as soon >> as I get to my office I'll test it for you. > > Ok, waiting. It works for me, and I added a few tests. Just wanted to > do an additional beta test. Sure! And it worked perfectly fine here. Including the use of my custom function. The generated query was now: ================================================================================ SELECT neolab.v_resultados_resumo.id, neolab.v_resultados_resumo.cliente_id, neolab.v_resultados_resumo.nao_conformidade_id, neolab.v_resultados_resumo.segmento_id, neolab.v_resultados_resumo.cliente_nome, neolab.v_resultados_resumo.material_coletado_id, neolab.v_resultados_resumo.material_coletado, neolab.v_resultados_resumo.amostra_id, neolab.v_resultados_resumo.id, neolab.v_resultados_resumo.analise, neolab.v_resultados_resumo.situacao, neolab.v_resultados_resumo.data_cadastro, neolab.v_resultados_resumo.previsao_entrega, neolab.v_resultados_resumo.entregue_em, neolab.v_resultados_resumo.recebido_em, neolab.v_resultados_resumo.ref_externa, neolab.v_resultados_resumo.nome_paciente, neolab.v_resultados_resumo.nome_paciente_normalizado, neolab.v_resultados_resumo.autenticacao, neolab.v_resultados_resumo.emitir_laudo FROM neolab.v_resultados_resumo WHERE ((((neolab.v_resultados_resumo.segmento_id) = (1)) AND (((neolab.v_resultados_resumo.data_cadastro) >= ('2006-04-18 00:00:00')) AND ((neolab.v_resultados_resumo.data_cadastro) <= ('2007-04-24 00:00:00')))) AND ((neolab.v_resultados_resumo.nome_paciente_normalizado) LIKE (f_v_texto('jose') || '%'))) ORDER BY id ================================================================================ My SQL Object code that generated this was: ================================================================================ if nome_paciente: amostras = amostras.filter( model.VResultadoResumo.q.nomePacienteNormalizado.startswith( func.f_v_texto(nome_paciente))) ================================================================================ Where model.VResultadoResumo points to a VIEW and func.f_v_texto is a function at PostgreSQL's public schema. It is perfectly as I expected it to be. ;-) So you have a "go" from me. It worked flawless. Thank you very much, Oleg! You help us writing beautiful code. ;-) -- Jorge Godoy <jg...@gm...> |