From: Yuval T. <yu...@ad...> - 2005-07-14 11:24:13
|
Hi, The new module raises a _db2.Error when the db2 returns SQL0000W after .execute() (see http://publib.boulder.ibm.com/infocenter/db2help/index.jsp?topic=/com.ibm.db2.udb.doc/core/rsql0500.htm ) According to the DB2 documentation, codes can end with W, C, and N. Meaning "Warning or informational messages", "Critical system errors", and "Error messages (don't know why 'N')" In the previous versions, this was simply ignored: if (rc1 != SQL_NO_DATA && rc1 != SQL_SUCCESS) { /* XXX need to cope with SQL_SUCCESS_WITH_INFO */ return DB2_report_error(self); } ... etc ... So, since this is a warning, I think the best fix would be to add the warning to the messages member rather than raising an error. It's an easy one to fix: ------------- snip ------------ --- v1.1/_db2_module.c 2005-03-09 03:34:48.000000000 +0200 +++ v1.1-devel/_db2_module.c 2005-07-14 14:19:13.537755000 +0300 @@ -1062,7 +1062,7 @@ DB2CursorObj_execute(DB2CursorObj *self, if (rc == SQL_SUCCESS) { ; - } else if (rc == SQL_SUCCESS_WITH_INFO) { + } else if (rc == SQL_SUCCESS_WITH_INFO || rc == SQL_NO_DATA_FOUND) { _DB2CursorObj_fill_Cursor_messages(self); } else { return _DB2CursorObj_Cursor_Error(self, NULL); ------------- snip ------------ This will append the warning to the cursor.messages: >>> c.messages [(<class _db2.Warning at 0x815c6ac>, ('02000', 100, '[IBM][CLI Driver][DB2/LINUX ] SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a que ry is an empty table. SQLSTATE=02000\n'))] >>> I think we should set up a nice and simple html site in pydb2.sf.net and a working cvs... What do you think? Thanks, Yuval. |