1
在OpenERP的7,我使用的是cr.execute執行SQL請求的OpenERP/Odoo - 在字符串中報價不工作 - cr.execute(SQL)
cr.execute('select distinct(value) from ir_translation where name = \'product.bat3,name\' and src = \''+ str(res_bat[j][0].encode('utf-8'))+'\' and res_id = '+ str(res_bat[j][1])+' and lang = \''+ str(line2.partner_id.lang)+'\'')
然而,我的字符串res_bat [ j] [0]是一個帶有 引號的字符串。該字符串是:測試的 因此我有波紋管的錯誤:
ProgrammingError: syntax error at or near "s"
LINE 1: ... where name = 'product.bat3,name' and src = 'test's' and res...
如何修改我的SQL請求,糾正這一錯誤?
完美!謝謝! – Selverine