Re: [pysqlite] sqlite3* to python connection typemap

Roger Binns <[email protected]> Sun, 14 Sep 2008 01:12:01 -0700
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
Dzhelil Rufat wrote:
> I am currently writing a SWIG wrapper to a C application, 

You should look at using ctypes instead as it is far more convenient
unless you have to link statically.

> PyInt_FromLong()

The C API functions are PyLong_FromVoidPtr and PyLong_AsVoidPtr.  To my
knowledge neither pysqlite nor apsw have the function you want, although
it is a one liner and I will add it to apsw for the next release.

You can also do it without adding a method as the sqlite connection
pointer is the first member after Py_HEAD for both pysqlite and apsw but
that requires some ninja ctypes skills to extract :-)

Roger