[Mono-bugs] [Bug 339035] New: ExecuteNonQuery in OdbcCommand. cs does not check return value of SQLRowCount

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Nov 5 03:41:50 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=339035

           Summary: ExecuteNonQuery in OdbcCommand.cs does not check return
                    value of SQLRowCount
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: i686
        OS/Version: openSUSE 10.3
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: knirav at novell.com
        ReportedBy: glen.a.ford at gmail.com
         QAContact: mono-bugs at ximian.com
          Found By: Development


ExecuteNonQuery in OdbcCommand.cs does not check return value of SQLRowCount

Using Informix it appears that rowcount may still be set from a previous
ExecuteNonQuery if the current one fails, leading to incorrect results.

Whilst the MSDN documentation indicates that RowCount should be reset on each
call, it does also mention in other documentation that it is driver dependant.

I believe that the return value should be checked and an exception thrown if it
the return is not success or success with information.

Suggested patch below:


Index: OdbcCommand.cs
===================================================================
--- OdbcCommand.cs      (revision 82464)
+++ OdbcCommand.cs      (working copy)
@@ -448,6 +448,8 @@

                                int numrows = 0;
                                OdbcReturn ret = libodbc.SQLRowCount(hstmt,ref
numrows);
+                           if ((ret!=OdbcReturn.Success) &&
(ret!=OdbcReturn.SuccessWithInfo)) 
+                               throw new OdbcException(new
OdbcError("SQLRowCount",OdbcHandleType.Stmt,hstmt));
                                records = numrows;
                         }
                         else


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list