Here are my notes so far:
For Windows, the only thing you need is: python and pymssql-0.8.0.win32-py2.5.exe and maybe whatever my VFP/SQL app installed to make an odbc connection. but I have a feeling what comes with XP is fine. I may try on 98 some day.
for Linux: (and maybe mac, but not tested at all)
get freetds
wget ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
build/install it.
or get a binary for your distro: http://packages.ubuntu.com/edgy/devel/freetds-dev sudo apt-get install freetds-dev
get pymssql-0.8.0.tar.gz from http://pymssql.sourceforge.net/#building
Then apply this patch:
Index: pymssql.py
===================================================================
RCS file: /cvsroot/pymssql/pymssql/pymssql.py,v
retrieving revision 1.14
diff -u -r1.14 pymssql.py
--- pymssql.py 24 Sep 2006 09:07:01 -0000 1.14
+++ pymssql.py 13 Jan 2007 17:03:03 -0000
@@ -200,9 +200,9 @@
pass
def _quote(x):
- if type(x) == types.StringType:
+ if isinstance(x,basestring):
x = "'" + string.replace(str(x), "'", "''") + "'"
- elif type(x) in (types.IntType, types.LongType, types.FloatType):
+ elif isinstance(x, (int, long, float)):
pass
elif x is None:
x = 'NULL'
@@ -285,6 +285,28 @@
return pymssqlCursor(self.__cnx)
except:
raise OperationalError, "invalid connection."
+
+
+ ##### Added by EGL for Dabo, 2006.12.28
+ # These methods simply pass the request through to
+ # the actual connection.
+ def connected(self):
+ return self.__cnx.connected()
+ def errmsg(self):
+ return self.__cnx.errmsg()
+ def fetch_array(self):
+ return self.__cnx.fetch_array()
+ def query(self, sql):
+ return self.__cnx.query(sql)
+ def select_db(self):
+ return self.__cnx.select_db()
+ def set_login_timeout(self, val):
+ return self.__cnx.set_login_timeout(val)
+ def set_query_timeout(self, val):
+ return self.__cnx.set_query_timeout(val)
+ def stdmsg(self):
+ return self.__cnx.stdmsg()
+ ##### END changes by EGL
Save that to pymssql.py.diff (or dl it from somewhere) and issue:
carl@dell17:~/src/pymssql$ patch pymssql.py pymssql.py.diff
Build/install it: carl@dell17:~/src/pymssql$ python setup.py install