dg*****@gmail.com wrote:
I'm developing an application using the C language and Python for it's
plugins. The C program connects to a MySQL database and keeps that
connection active. Is it possible to 'share' this connection with the
Python plugins? If so, is there a "standard" way to do that?
There is no simple way as MySQL connections in Python are Python
extension objects. You'll probably have to use a custom MySQL driver.
Either create the session in C and add a constructor to the python to
create a MySQL connection object from that handle or pointer
Or add a method to the Python MySQL object to get the handle and
pointer. Create all database connections in Python (precise: using the
Python API from C), get the handle and pointer to use it from C, pass
the original session to plugins.
Daniel