From: Preston L. <pla...@jo...> - 2005-01-20 16:06:26
|
It sounds like there may be a new release of the PyDB2 module coming up soon... Is there any interest in accepting this patch to handle the SQL_SUCCESS_WITH_INFO state? Not handling this is kind of a release critical bug for PyDB2 as used in my company, since a valid query in my app produces this result. I should have access to check it in through my Sourceforge account (planders) I just haven't gotten to it yet. There was also some concern about the handling of the "info". I was stashing it in the LastWarningString variable. Primitive, I know, but I don't have any better ideas at this point. thanks, Preston Landers (512) 225-3929 | pla...@jo... | "For 'tis the sport to have the enginer Senior Software Developer | Hoist with his owne petar" Journyx, Austin, Texas, USA | -- Shakespeare, Hamlet III iv. ---------- Forwarded message ---------- Date: Thu, 15 Jan 2004 11:12:33 -0600 (CST) From: Preston Landers <pla...@jo...> To: pyd...@li... Subject: [PyDB2-discuss] Re: I have a patch to handle SQL_SUCCESS_WITH_INFO 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 |