diff -r f07e2fc66d62 Lib/test/zxjdbc/zxtest.py --- a/Lib/test/zxjdbc/zxtest.py Sun Jul 22 11:39:49 2012 -0700 +++ b/Lib/test/zxjdbc/zxtest.py Fri Jul 27 03:50:56 2012 -0600 @@ -642,20 +642,24 @@ c.close() def testUpdateCount(self): - """testing update count functionality""" + """testing update count and row count functionality""" c = self.cursor() try: c.execute("insert into zxtesting values (?, ?, ?)", [(500, 'bz', 'or')]) assert c.updatecount == 1, "expected [1], got [%d]" % (c.updatecount) + assert c.rowcount == 1, "expected [1], got [%d]" % (c.rowcount) c.execute("select * from zxtesting") self.assertEquals(None, c.updatecount) + self.assertEquals(8, c.rowcount) # there's a *feature* in the mysql engine where it returns 0 for delete if there is no # where clause, regardless of the actual value. using a where clause forces it to calculate # the appropriate value c.execute("delete from zxtesting where 1>0") assert c.updatecount == 8, "expected [8], got [%d]" % (c.updatecount) + assert c.rowcount == 8, "expected [8], got [%d]" % (c.rowcount) c.execute("update zxtesting set name = 'nothing'") self.assertEquals(0, c.updatecount) + self.assertEquals(0, c.rowcount) finally: c.close() diff -r f07e2fc66d62 src/com/ziclix/python/sql/PyCursor.java --- a/src/com/ziclix/python/sql/PyCursor.java Sun Jul 22 11:39:49 2012 -0700 +++ b/src/com/ziclix/python/sql/PyCursor.java Fri Jul 27 03:50:56 2012 -0600 @@ -18,6 +18,7 @@ import org.python.core.PyBuiltinMethodSet; import org.python.core.PyDictionary; import org.python.core.PyException; +import org.python.core.PyInteger; import org.python.core.PyList; import org.python.core.PyObject; import org.python.core.PyString; @@ -207,7 +208,8 @@ } else if ("description".equals(name)) { return this.fetch.description; } else if ("rowcount".equals(name)) { - return Py.newInteger(this.fetch.rowcount); + return updatecount instanceof PyInteger && ((PyInteger) updatecount).getValue() >= 0 + ? updatecount : Py.newInteger(this.fetch.rowcount); } else if ("rownumber".equals(name)) { int rn = this.fetch.rownumber; return (rn < 0) ? Py.None : Py.newInteger(rn);