iheanyi / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

FUTURE: ibm_db.pyd - cpython implementation replace with pure python+ctypes implementation #43

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
ctypes (http://docs.python.org/library/ctypes.html) is integral part of
python since 2.5 (for python 2.3 and 2.4 download can be found in original
project page http://sourceforge.net/projects/ctypes/files/). 

recently we did some python wrapping of some native libraries (originally
developed in C/, compiled on win32 - results are in dll-s). We did it with
python.ctypes and not with cpython/swig/boost or ... Our experience is
excellent, this approach is for reccomendation: 
 - it can be easily adapted to be platform independent - ctypes works
everywhere
 - everything we wanted to get from dll - with ctypes we could get it
(functions, params, structs, byref, addresses ...)
 - the best thing is - we don't need to recompile anything in the case of
change of wrapper source code and/or for different platform (python 2.*,
different OS-es etc.)
 - it is fast - critical parts are in C native libraries, wrapper doesn't
have and time-critical parts

Based on this experience, my reccommendation is that every new and if
possible for existing should be developed in pure python using ctypes when
needed to access some native functions.

So my suggestion is, at least, to take this in consideration when thinking
about next features of ibm_db project: 
 - to replace ibm_db.pyd with pure python+ctypes.

I have looked source of ibm_db.c and the task of converting this to ctypes
won't be easy and fast. On other hand this conversion could get many
benefits: no issues with diff. python versions, no issues with different
operation systems, easy adaptation for different db2 client versions, solve
issue of new python 3.* cpython api backward incompatible changes, easier
and faster maintainance, development and deployment ...

Original issue reported on code.google.com by trebor74hr@gmail.com on 9 Jan 2010 at 5:29

GoogleCodeExporter commented 9 years ago
Thanks for your suggestions. We will keep this in our mind for future.

Original comment by rahul.pr...@in.ibm.com on 11 Jan 2010 at 6:28

GoogleCodeExporter commented 9 years ago
Following idea is similar - but instead linking to db engine client library 
they re-implemented db-engine protocol (mysql): 

https://launchpad.net/myconnpy

"""
MySQL Connector/Python is implementing the MySQL Client/Server protocol 
completely in Python. No MySQL libraries are needed, and no compilation is 
necessary to run this Python DB API v2.0 compliant driver.
"""

Original comment by trebor74hr@gmail.com on 15 Oct 2010 at 1:04

GoogleCodeExporter commented 9 years ago
Please delete

Original comment by scruz.maui808 on 17 Jun 2014 at 4:38