[DB-SIG] ODBC Access

M.-A. Lemburg mal@lemburg.com
Mon, 24 Jan 2000 12:20:07 +0100

Frank McGeough wrote:
> Hi All,
> I've built a fairly full featured odbc access layer for my C++
> programmers. I've spent a lot of time optimizing it and dealing with
> the idiosyncracies of various odbc drivers. I'd like to extend it to
> the Python folk. I looked at the some of the extensions that are
> included with Python like the odbc.pyd in win32 land. All the
> extensions I've examined have been pretty messy 'C' code. I get the
> general idea --- there seems to be a table of function pointers and
> everything seems to be a PyObject --- but I was wondering if there are
> more extensive samples of class libraries converted to extensions?
> Also are there automated tools in this area? Where can I turn for help
> in this process?

Check out SWIG which works great for semi-automagically wrapping
C++ libs for use in Python (and other languages): http://www.swig.org
> I have the following general set of classes:
> CDBIDatabase (used to open up a particular data source)
> CDBIConnection (obtained from a database. Can be more than one per
> database).
> CDBITable (encapsulates the idea of a database table).
> CDBIColumn (encapsulates the idea of a database column).
> CDBISchema (description of a schema - made up of CDBIColumns)
> CDBIForeignKey (description of fkey).
> CDBIRow (a row of result information, made of up of an ordrered
> collection of CDBIValue's)
> CDBICursor (a db cursor - may be forward only or bi-directional).
> CDBIValue (a database value obtained by executing some sql statement).

Do you have some sample code using these classes ? What
methods do tables and columns have in your lib ?
> I've also provided a set of classes to wrap database types - like Blob
> and String and DateTime. My class library doesn't seem to fit into dbi
> either but that's a lesser consideration for my internal folk. Each of
> my classes is coded as a reference counted interface/implementation. I
> currently deliver this to the C++ programmers as Windows (win32) DLL.
> Any help or pointers appreciated.

Marc-Andre Lemburg
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/