Re: [SQLObject] Trouble with threads...
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Neil M. <drn...@gm...> - 2008-02-16 13:53:25
|
On Feb 12, 2008 4:21 AM, Nathan Edwards <nj...@ge...> wrote: > The MySQLdb error: > > Exception _mysql_exceptions.ProgrammingError: (2014, "Commands out of > sync; you can't run this command now") in <bound method > Cursor.__del__ of <MySQLdb.cursors.Cursor object at 0x2a99c68ad0>> > ignored > > is pretty consistent, and sometimes I get an "InterfaceError" from > sqlobject. >From the mysqldb Documentation: The MySQL protocol can not handle multiple threads using the same connection at once. Some earlier versions of MySQLdb utilized locking to achieve a threadsafety of 2. While this is not terribly hard to accomplish using the standard Cursor class (which uses ``mysql_store_result()``), it is complicated by SSCursor (which uses ``mysql_use_result()``; with the latter you must ensure all the rows have been read before another query can be executed. So mysql connections need to be managed in the same why as is currently done for sqlite, which also doesn't allow conenctions to be shared across threads. I've added a quick patch to do this, based of the logic in sqliteconnection, to the sourceforge issue tracker (# 1894909), which fixes the issue for me. -- Neil Muller I've got a gmail account. Why haven't I become cool? |