diff --git a/src/connector/python/linux/python2/taos/cinterface.py b/src/connector/python/linux/python2/taos/cinterface.py index 758244b6d85fb9cdc40daf10f38c8a595326528c..1b17bf72b0357a929d8ae4ddc0dc549d68793ca7 100644 --- a/src/connector/python/linux/python2/taos/cinterface.py +++ b/src/connector/python/linux/python2/taos/cinterface.py @@ -149,6 +149,7 @@ class CTaosInterface(object): libtaos.taos_consume.restype = ctypes.c_void_p libtaos.taos_fetch_lengths.restype = ctypes.c_void_p libtaos.taos_free_result.restype = None + libtaos.taos_errno.restype = ctypes.c_int def __init__(self, config=None): ''' diff --git a/src/connector/python/linux/python2/taos/cursor.py b/src/connector/python/linux/python2/taos/cursor.py index 6bf8236ac99cd81377d26bfd1f203abea32749b5..75aa7f69d866044c4d069722794df0effe78bff6 100644 --- a/src/connector/python/linux/python2/taos/cursor.py +++ b/src/connector/python/linux/python2/taos/cursor.py @@ -126,7 +126,8 @@ class TDengineCursor(object): with open(self._logfile, "a") as logfile: logfile.write("%s;\n" % operation) - if self._result is not None: + errno = CTaosInterface.libtaos.taos_errno(self._result) + if errno == 0: if CTaosInterface.fieldsCount(self._result) == 0: self._affected_rows += CTaosInterface.affectedRows( self._result ) diff --git a/src/connector/python/linux/python3/taos/cinterface.py b/src/connector/python/linux/python3/taos/cinterface.py index b953aa11926ba4f0779bdcb94454bdbe96bd78b4..87540bf32602aa8cde98108c04fc159ad14c098b 100644 --- a/src/connector/python/linux/python3/taos/cinterface.py +++ b/src/connector/python/linux/python3/taos/cinterface.py @@ -149,6 +149,7 @@ class CTaosInterface(object): libtaos.taos_consume.restype = ctypes.c_void_p libtaos.taos_fetch_lengths.restype = ctypes.c_void_p libtaos.taos_free_result.restype = None + libtaos.taos_errno.restype = ctypes.c_int def __init__(self, config=None): ''' diff --git a/src/connector/python/linux/python3/taos/cursor.py b/src/connector/python/linux/python3/taos/cursor.py index 724cfe2163186cfaf584a061202291fe5da5907f..3baca89462ab066b2643e0fe43df5ecd089ff9db 100644 --- a/src/connector/python/linux/python3/taos/cursor.py +++ b/src/connector/python/linux/python3/taos/cursor.py @@ -124,12 +124,12 @@ class TDengineCursor(object): # print(" >> Exec Query ({}): {}".format(localSeqNum, str(stmt))) self._result = CTaosInterface.query(self._connection._conn, stmt) # print(" << Query ({}) Exec Done".format(localSeqNum)) - if (self._logfile): with open(self._logfile, "a") as logfile: logfile.write("%s;\n" % operation) - if self._result is not None: + errno = CTaosInterface.libtaos.taos_errno(self._result) + if errno == 0: if CTaosInterface.fieldsCount(self._result) == 0: self._affected_rows += CTaosInterface.affectedRows( self._result ) diff --git a/src/connector/python/windows/python2/taos/cinterface.py b/src/connector/python/windows/python2/taos/cinterface.py index e58ebbc8da4900a74224c8867837af7d36d6214c..9fb7d4ec098e79b3464aefa43aeef03d789e12ed 100644 --- a/src/connector/python/windows/python2/taos/cinterface.py +++ b/src/connector/python/windows/python2/taos/cinterface.py @@ -149,6 +149,7 @@ class CTaosInterface(object): libtaos.taos_consume.restype = ctypes.c_void_p libtaos.taos_fetch_lengths.restype = ctypes.c_void_p libtaos.taos_free_result.restype = None + libtaos.taos_errno.restype = ctypes.c_int def __init__(self, config=None): ''' diff --git a/src/connector/python/windows/python2/taos/cursor.py b/src/connector/python/windows/python2/taos/cursor.py index 0d7c882baf54bdb24c30eb2e07bcb425f1c04121..6af82e72de141593e2074b9f084364e9032c3e61 100644 --- a/src/connector/python/windows/python2/taos/cursor.py +++ b/src/connector/python/windows/python2/taos/cursor.py @@ -110,7 +110,8 @@ class TDengineCursor(object): pass self._result = CTaosInterface.query(self._connection._conn, stmt) - if self._result is not None: + errno = CTaosInterface.libtaos.taos_errno(self._result) + if errno == 0: if CTaosInterface.fieldsCount(self._result) == 0: self._affected_rows += CTaosInterface.affectedRows(self._result) return CTaosInterface.affectedRows(self._result ) diff --git a/src/connector/python/windows/python3/taos/cinterface.py b/src/connector/python/windows/python3/taos/cinterface.py index 2217ad5c58d709ffef2ba5600ed323c9a5c8be65..0dbb2ce3a1fe09fedb729e767d649b74ed8d5948 100644 --- a/src/connector/python/windows/python3/taos/cinterface.py +++ b/src/connector/python/windows/python3/taos/cinterface.py @@ -149,6 +149,7 @@ class CTaosInterface(object): libtaos.taos_consume.restype = ctypes.c_void_p libtaos.taos_fetch_lengths.restype = ctypes.c_void_p libtaos.taos_free_result.restype = None + libtaos.taos_errno.restype = ctypes.c_int def __init__(self, config=None): ''' diff --git a/src/connector/python/windows/python3/taos/cursor.py b/src/connector/python/windows/python3/taos/cursor.py index ebc549ec988cf9ada7a2edaf14e8bcd66dcaefd4..0ee8af4ed00a219f405d4cddec01e199ae059574 100644 --- a/src/connector/python/windows/python3/taos/cursor.py +++ b/src/connector/python/windows/python3/taos/cursor.py @@ -110,7 +110,8 @@ class TDengineCursor(object): pass self._result = CTaosInterface.query(self._connection._conn, stmt) - if self._result is not None: + errno = CTaosInterface.libtaos.taos_errno(self._result) + if errno == 0: if CTaosInterface.fieldsCount(self._result) == 0: self._affected_rows += CTaosInterface.affectedRows(self._result ) return CTaosInterface.affectedRows(self._result )