[DB-SIG] ms, unicode and errors
Carl Karsten
carl at personnelware.com
Fri Jan 12 02:09:07 CET 2007
I am not exactly sure where to post this, so sorry if I am too far OT. I
couldn't find any appropriate place on http://pymssql.sourceforge.net
There are really 2 problems: unicode and empty error message
When I run this code, I get the following:
con = pymssql.connect(host='me',user='sa',password='abc',database='northwind' )
cur=con.cursor()
sqlCmd= """select LastName, FirstName, EmployeeID
from Employees
where LastName = %(lName)s """
parms = { 'lName': u'Fuller' }
cur.execute( sqlCmd, parms )
Traceback (most recent call last):
File "/home/carl/tst.py", line 13, in ?
cur.execute( sqlCmd, parms )
File "/usr/lib/python2.4/site-packages/pymssql.py", line 126, in execute
self.executemany(operation, (params,))
File "/usr/lib/python2.4/site-packages/pymssql.py", line 154, in executemany
raise DatabaseError, "internal error: %s" % self.__source.errmsg()
pymssql.DatabaseError: internal error: None
Remove the u before 'Fuller', the query executes with no error.
So, is this to be expected? My guess is that I should be getting some sort of
data type mismatch error.
Carl K
More information about the DB-SIG
mailing list