Skip to content

Commit 4ccad73

Browse files
committed
Report one total for changes when multiple commands
1 parent 2032773 commit 4ccad73

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sql.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ int reportid = 0;
5050
int reportchanges = 0;
5151
int statuschanges = 0;
5252
int ret = 0;
53+
unsigned long long changed = 0;
5354
int linesplit = 0;
5455
int safe = 0;
5556
int unsafe = 0;
@@ -329,8 +330,7 @@ dosql (const char *origquery)
329330
else if (*uuid)
330331
printf ("%s\n", uuid);
331332
}
332-
if (reportchanges)
333-
printf ("%llu\n", sql_affected_rows (&sql));
333+
changed += sql_affected_rows (&sql);
334334
if (statuschanges && !sql_affected_rows (&sql))
335335
ret++;
336336
}
@@ -514,5 +514,7 @@ main (int argc, const char *argv[])
514514
xml = xml_tree_delete (xml);
515515
}
516516
#endif
517+
if (reportchanges)
518+
printf ("%llu\n", changed);
517519
return ret;
518520
}

0 commit comments

Comments
 (0)