diff --git a/src/connector/python/linux/python2/taos/cursor.py b/src/connector/python/linux/python2/taos/cursor.py index 933efbde228334ac3d039c3a614dc45064d86366..f18920c553aedf6e475c66643e6c336455df77f4 100644 --- a/src/connector/python/linux/python2/taos/cursor.py +++ b/src/connector/python/linux/python2/taos/cursor.py @@ -31,6 +31,7 @@ class TDengineCursor(object): self._block = None self._block_rows = -1 self._block_iter = 0 + self._affected_rows = 0 if connection is not None: self._connection = connection @@ -66,6 +67,12 @@ class TDengineCursor(object): """ return self._rowcount + @property + def affected_rows(self): + """Return the affected_rows of the object + """ + return self._affected_rows + def callproc(self, procname, *args): """Call a stored database procedure with the given name. @@ -105,6 +112,7 @@ class TDengineCursor(object): res = CTaosInterface.query(self._connection._conn, stmt) if res == 0: if CTaosInterface.fieldsCount(self._connection._conn) == 0: + self._affected_rows += CTaosInterface.affectedRows(self._connection._conn) return CTaosInterface.affectedRows(self._connection._conn) else: self._result, self._fields = CTaosInterface.useResult(self._connection._conn) @@ -167,6 +175,7 @@ class TDengineCursor(object): self._block = None self._block_rows = -1 self._block_iter = 0 + self._affected_rows = 0 def _handle_result(self): """Handle the return result from query. @@ -175,4 +184,4 @@ class TDengineCursor(object): for ele in self._fields: self._description.append((ele['name'], ele['type'], None, None, None, None, False)) - return self._result \ No newline at end of file + return self._result diff --git a/src/connector/python/linux/python3/taos/cursor.py b/src/connector/python/linux/python3/taos/cursor.py index 656a348472d31a891fa492bb4d19f3c0ccbf6941..7a0ae767bc26122c0d8f404b2d9bc7590d2c3795 100644 --- a/src/connector/python/linux/python3/taos/cursor.py +++ b/src/connector/python/linux/python3/taos/cursor.py @@ -31,6 +31,7 @@ class TDengineCursor(object): self._block = None self._block_rows = -1 self._block_iter = 0 + self._affected_rows = 0 if connection is not None: self._connection = connection @@ -66,6 +67,12 @@ class TDengineCursor(object): """ return self._rowcount + @property + def affected_rows(self): + """Return the rowcount of insertion + """ + return self._affected_rows + def callproc(self, procname, *args): """Call a stored database procedure with the given name. @@ -105,6 +112,7 @@ class TDengineCursor(object): res = CTaosInterface.query(self._connection._conn, stmt) if res == 0: if CTaosInterface.fieldsCount(self._connection._conn) == 0: + self._affected_rows += CTaosInterface.affectedRows(self._connection._conn) return CTaosInterface.affectedRows(self._connection._conn) else: self._result, self._fields = CTaosInterface.useResult(self._connection._conn) @@ -167,6 +175,7 @@ class TDengineCursor(object): self._block = None self._block_rows = -1 self._block_iter = 0 + self._affected_rows = 0 def _handle_result(self): """Handle the return result from query. @@ -175,4 +184,4 @@ class TDengineCursor(object): for ele in self._fields: self._description.append((ele['name'], ele['type'], None, None, None, None, False)) - return self._result \ No newline at end of file + return self._result diff --git a/src/connector/python/windows/python2/taos/cursor.py b/src/connector/python/windows/python2/taos/cursor.py index 933efbde228334ac3d039c3a614dc45064d86366..976ec06707e7dd6f0a86a84ea9bce80e786875bc 100644 --- a/src/connector/python/windows/python2/taos/cursor.py +++ b/src/connector/python/windows/python2/taos/cursor.py @@ -31,6 +31,7 @@ class TDengineCursor(object): self._block = None self._block_rows = -1 self._block_iter = 0 + self._affected_rows = 0 if connection is not None: self._connection = connection @@ -66,6 +67,12 @@ class TDengineCursor(object): """ return self._rowcount + @property + def affected_rows(self): + """Return the affected_rows of the object + """ + return self._affected_rows + def callproc(self, procname, *args): """Call a stored database procedure with the given name. @@ -105,6 +112,7 @@ class TDengineCursor(object): res = CTaosInterface.query(self._connection._conn, stmt) if res == 0: if CTaosInterface.fieldsCount(self._connection._conn) == 0: + self._affected_rows += CTaosInterface.affectedRows(self._connection._conn) return CTaosInterface.affectedRows(self._connection._conn) else: self._result, self._fields = CTaosInterface.useResult(self._connection._conn) @@ -167,7 +175,8 @@ class TDengineCursor(object): self._block = None self._block_rows = -1 self._block_iter = 0 - + self._affected_rows = 0 + def _handle_result(self): """Handle the return result from query. """ @@ -175,4 +184,4 @@ class TDengineCursor(object): for ele in self._fields: self._description.append((ele['name'], ele['type'], None, None, None, None, False)) - return self._result \ No newline at end of file + return self._result diff --git a/src/connector/python/windows/python3/taos/cursor.py b/src/connector/python/windows/python3/taos/cursor.py index ac70c379582263ae4d858750a17a0c859354a7f4..c7f34006422b559e21b75f36dcf81248e0b94713 100644 --- a/src/connector/python/windows/python3/taos/cursor.py +++ b/src/connector/python/windows/python3/taos/cursor.py @@ -31,6 +31,7 @@ class TDengineCursor(object): self._block = None self._block_rows = -1 self._block_iter = 0 + self._affected_rows = 0 if connection is not None: self._connection = connection @@ -66,6 +67,12 @@ class TDengineCursor(object): """ return self._rowcount + @property + def affected_rows(self): + """Return the affected_rows of the object + """ + return self._affected_rows + def callproc(self, procname, *args): """Call a stored database procedure with the given name. @@ -105,6 +112,7 @@ class TDengineCursor(object): res = CTaosInterface.query(self._connection._conn, stmt) if res == 0: if CTaosInterface.fieldsCount(self._connection._conn) == 0: + self._affected_rows += CTaosInterface.affectedRows(self._connection._conn) return CTaosInterface.affectedRows(self._connection._conn) else: self._result, self._fields = CTaosInterface.useResult(self._connection._conn) @@ -167,6 +175,7 @@ class TDengineCursor(object): self._block = None self._block_rows = -1 self._block_iter = 0 + self._affected_rows = 0 def _handle_result(self): """Handle the return result from query. @@ -175,4 +184,4 @@ class TDengineCursor(object): for ele in self._fields: self._description.append((ele['name'], ele['type'], None, None, None, None, False)) - return self._result \ No newline at end of file + return self._result