Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8c219d9

Browse filesBrowse files
authored
Merge pull request PyMySQL#100 from methane/mysql-affected-rows-error
mysql_affected_rows may return -1
2 parents f2ab098 + ac1fb2d commit 8c219d9
Copy full SHA for 8c219d9

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed

‎_mysql.c

Copy file name to clipboardExpand all lines: _mysql.c
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,9 +823,13 @@ _mysql_ConnectionObject_affected_rows(
823823
_mysql_ConnectionObject *self,
824824
PyObject *args)
825825
{
826+
my_ulonglong ret;
826827
if (!PyArg_ParseTuple(args, "")) return NULL;
827828
check_connection(self);
828-
return PyLong_FromUnsignedLongLong(mysql_affected_rows(&(self->connection)));
829+
ret = mysql_affected_rows(&(self->connection));
830+
if (ret == (my_ulonglong)-1)
831+
return PyInt_FromLong(-1);
832+
return PyLong_FromUnsignedLongLong(ret);
829833
}
830834

831835
static char _mysql_debug__doc__[] =

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.