From: Preston L. <pla...@jo...> - 2004-01-14 22:57:17
|
Greetings to all on the list. I'm not seeing much activity on this list or with the driver in general. I'm not sure if that means not many people are using it, or maybe it just works so well there's not much to discuss or change. ;-) We here at Journyx, Inc. (www.journyx.com - free timekeeping for 10 users or less) have been using this driver with good results for a while now. Most of our customers are NOT using DB2 (most are on Postgresql, SQL Server, and Oracle) but the few who do are depending on this driver for their production Time and Expense data. 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(). I thought these changes would be generally useful. Unless there is disagreement about the design (LastWarningString) the changes should be ready to patch into the latest version. I'm open to suggestions for a better design to handle SQL_SUCCESS_WITH_INFO. What is the best way to provide a patch such as this? Should I just attach the new versions of the files to an email to this list and let a maintainer diff the changes in? thanks, Preston Landers - pla...@jo... Senior Software Developer, Journyx, Inc. Austin, Texas (512) 225-3929 |