|
From: Preston L. <pla...@jo...> - 2004-01-15 17:06:31
|
On Wed, 14 Jan 2004, Preston Landers wrote:
> We ran into a situation recently where we wanted to use a certain
> construct in DB2 that was generating the SQL0347W warning about recursion.
> The DB2.py driver was raising this non-fatal warning as a error (and not
> returning the result rows.)
>
> Digging a bit deeper I found that this is the SQL_SUCCESS_WITH_INFO result
> code. The current driver (_db2_module.c) has a comment to the effect of
> "need to cope with SQL_SUCCESS_WITH_INFO."
>
> I took what seemed to me to be the most simple and direct route to fix
> this problem. I simply added a 'LastWarningString' attribute to the
> internal cursor object. This is cleared before every statement execution.
> If SQL_SUCCESS_WITH_INFO is encountered then LastWarningString is updated
> with the warning text, and the result rows are returned.
>
> It is then up to the caller to check LastWarningString after every query
> if they care about that. I also made a minor change in DB2.py BaseCursor
> class to copy over the LastWarningString in _refresh_info().
Attached are the three files that I modified to make this change.
_db2_module.c -- handle SQL_SUCCESS_WITH_INFO by setting the warning
to a cursor variable LastWarningString
DB2.py -- copy over LastWarningString in _refresh_info().
Also changed 'x in dict' Python 2.2 syntax to the
equivelent has_key() so it will work with Py 2.1.
README -- just added a note about checking LastWarningString
By the way, my Sourceforge account is 'planders'.
thanks,
---
Preston Landers - pla...@jo...
Senior Software Developer, Journyx, Inc.
Austin, Texas (512) 225-3929
|