Thread: [SQLObject] MySQL backend removes backslashes
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Markus G. <m.g...@gm...> - 2007-09-04 18:35:11
|
Hi, when running the self contained test script below using the SQLite backend, the output correctly reads C:\some\path When using the MySQL backend is reads C:somepath Is this a bug? What is the behavior of other backends. Shouldn't SQLObject escape the backslashes for the MySQL backend? Kind regards, Markus from sqlobject import * # SQLite works fine #sqlhub.processConnection = connectionForURI('sqlite:/:memory:') # MySQL removes backslashes sqlhub.processConnection = connectionForURI('mysql://markus@localhost/test') class Test(SQLObject): name = StringCol() Test.dropTable(ifExists = True) Test.createTable(ifNotExists = True) Test(name=r'C:\some\path') print Test.get(1).name # C:somepath when using MySQL |
From: Oleg B. <ph...@ph...> - 2007-09-05 10:34:03
|
On Tue, Sep 04, 2007 at 08:35:09PM +0200, Markus Gritsch wrote: > Test(name=r'C:\some\path') > print Test.get(1).name # C:somepath when using MySQL SQLite: 4/QueryIns: INSERT INTO test (name) VALUES ('C:\some\path') C:\some\path Postgres: 1/QueryIns: INSERT INTO test (id, name) VALUES (1, 'C:\\some\\path') C:\some\path Please add "?debug=1" to your DB URI and show the output. What version of SQLObject are you using? Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Markus G. <m.g...@gm...> - 2007-09-05 12:41:56
|
2007/9/5, Oleg Broytmann <ph...@ph...>: > Please add "?debug=1" to your DB URI and show the output. What version > of SQLObject are you using? I used SQLObject-0.9.1-py2.5.egg which I downloaded on 2007-07-26. If I compare this version with a recently downloaded version of the same file, I can see a change in converters.py. My version reads if db == 'postgres': for orig, repl in sqlStringReplace: value = value.replace(orig, repl) elif db in ('sqlite', 'mysql', 'firebird', 'sybase', 'maxdb', 'mssql'): value = value.replace("'", "''") whereas the current version reads if db in ('mysql', 'postgres'): for orig, repl in sqlStringReplace: value = value.replace(orig, repl) elif db in ('sqlite', 'firebird', 'sybase', 'maxdb', 'mssql'): value = value.replace("'", "''") The current version fixes the reported problem. However making changes in already released versions without increasing the version number is not optimal. Kind regards, Markus |
From: Oleg B. <ph...@ph...> - 2007-09-05 12:49:25
|
On Wed, Sep 05, 2007 at 02:41:53PM +0200, Markus Gritsch wrote: > making > changes in already released versions without increasing the version > number is not optimal. Mea culpa! I found a brown paper bag bug a minute after I have released 0.9.1, so I tried to hide my fault... and failed. Sorry. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Markus G. <m.g...@gm...> - 2007-09-05 12:51:56
|
2007/9/5, Oleg Broytmann <ph...@ph...>: > Mea culpa! I found a brown paper bag bug a minute after I have released > 0.9.1, so I tried to hide my fault... and failed. Sorry. No problem. I could also be blamed for eagerly downloading immediately after the release e-mail ;) |