[Zope] using a ZMySQL database connection object in an external method

Andy Dustman andy@dustman.net
Thu, 7 Jun 2001 20:07:19 -0400 (EDT)


On Wed, 6 Jun 2001, Luby Liao wrote:
>
> Is there a How-To, or are there some code fragments that will help me
> use a ZMySQL (or a psycopg) database connection object in an external
> method?  Given that mysql_connection is a ZMySQL database connection
> object, I expected
>
>   mysql_connection.db.select_db('database')
>
> to work. But I got
>
>   Error Type: ProgrammingError
>   Error Value: (2014, "Commands out of sync; You can't run this command now")

This error is generated by either the MySQL client library or perhaps the
server itself. Why it failed depends on what you did before-hand. Also,
possibly another thread is using the connection at the same time. I
suspect that an External Method does not automatically respect any sort of
locks that Zope may put on a Connection Object to prevent it's
simultaneous use by multiple threads.

-- 
Andy Dustman         PGP: 0xC72F3F1D
    @       .net     http://dustman.net/andy
"I'd rather listen to Newton than to Mundie. He may have been dead for almost
three hundred years, but despite that he stinks up the room less." -- Linus T.