En Thu, 28 Jan 2010 05:07:00 -0300, Durumdara <durumd...@gmail.com> escribió:

I have an exotic db, with exotic drivers, and it have buggy  ODBC driver.

But I have native driver - under Delphi.

I need to access this DB under Pylons (or mod_python).
[...]
I think to COM/OLE, because it is accessable from all program, and I think
to DLL (but DLL have problematic parameterisation).

So, you can query the database in Delphi, and you want to be able to do that from Python.

Your two ideas are feasible: you may write a DLL (or a COM object) in Delphi, that takes a query string, executes it, and returns the resulting data. All in Delphi code, no Python involved. Keep the memory allocation in Delphi - allocate and return a plain PChar buffer, and include a free() function to deallocate it when the other side is done using it.

From Python, you may use ctypes [1] to call the DLL functions, or pywin32 [2] to invoke the COM object. Both ways are easy enough.

[1] http://docs.python.org/library/ctypes.html
[2] http://sourceforge.net/projects/pywin32/

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to