[SQLObject] converters.sqlStringReplace
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2004-11-13 17:39:13
|
Hello, Ian! >>> from DB import dbConn 1/Pool : ACQUIRE pool=[] >>> from sqlobject.sqlbuilder import Insert >>> insert = Insert("table", values={"name": "val'ue"}) >>> dbConn.sqlrepr(insert) "INSERT INTO table (name) VALUES ('val''ue')" Oops, that's wrong. Like in _likeQuote. MySQL and Postgres use \' to quote apostrophe, not ''. converters.sqlStringReplace[1] = ("'", "\\'") (at least for Postgres and MySQL). Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |