提交 f9a9a7bc 编写于 作者: T Tao Liu

[TD-519] fix execute sql return

上级 6084f5a7
...@@ -149,6 +149,7 @@ class CTaosInterface(object): ...@@ -149,6 +149,7 @@ class CTaosInterface(object):
libtaos.taos_consume.restype = ctypes.c_void_p libtaos.taos_consume.restype = ctypes.c_void_p
libtaos.taos_fetch_lengths.restype = ctypes.c_void_p libtaos.taos_fetch_lengths.restype = ctypes.c_void_p
libtaos.taos_free_result.restype = None libtaos.taos_free_result.restype = None
libtaos.taos_errno.restype = ctypes.c_int
def __init__(self, config=None): def __init__(self, config=None):
''' '''
......
...@@ -126,7 +126,8 @@ class TDengineCursor(object): ...@@ -126,7 +126,8 @@ class TDengineCursor(object):
with open(self._logfile, "a") as logfile: with open(self._logfile, "a") as logfile:
logfile.write("%s;\n" % operation) 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: if CTaosInterface.fieldsCount(self._result) == 0:
self._affected_rows += CTaosInterface.affectedRows( self._affected_rows += CTaosInterface.affectedRows(
self._result ) self._result )
......
...@@ -149,6 +149,7 @@ class CTaosInterface(object): ...@@ -149,6 +149,7 @@ class CTaosInterface(object):
libtaos.taos_consume.restype = ctypes.c_void_p libtaos.taos_consume.restype = ctypes.c_void_p
libtaos.taos_fetch_lengths.restype = ctypes.c_void_p libtaos.taos_fetch_lengths.restype = ctypes.c_void_p
libtaos.taos_free_result.restype = None libtaos.taos_free_result.restype = None
libtaos.taos_errno.restype = ctypes.c_int
def __init__(self, config=None): def __init__(self, config=None):
''' '''
......
...@@ -124,12 +124,12 @@ class TDengineCursor(object): ...@@ -124,12 +124,12 @@ class TDengineCursor(object):
# print(" >> Exec Query ({}): {}".format(localSeqNum, str(stmt))) # print(" >> Exec Query ({}): {}".format(localSeqNum, str(stmt)))
self._result = CTaosInterface.query(self._connection._conn, stmt) self._result = CTaosInterface.query(self._connection._conn, stmt)
# print(" << Query ({}) Exec Done".format(localSeqNum)) # print(" << Query ({}) Exec Done".format(localSeqNum))
if (self._logfile): if (self._logfile):
with open(self._logfile, "a") as logfile: with open(self._logfile, "a") as logfile:
logfile.write("%s;\n" % operation) 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: if CTaosInterface.fieldsCount(self._result) == 0:
self._affected_rows += CTaosInterface.affectedRows( self._affected_rows += CTaosInterface.affectedRows(
self._result ) self._result )
......
...@@ -149,6 +149,7 @@ class CTaosInterface(object): ...@@ -149,6 +149,7 @@ class CTaosInterface(object):
libtaos.taos_consume.restype = ctypes.c_void_p libtaos.taos_consume.restype = ctypes.c_void_p
libtaos.taos_fetch_lengths.restype = ctypes.c_void_p libtaos.taos_fetch_lengths.restype = ctypes.c_void_p
libtaos.taos_free_result.restype = None libtaos.taos_free_result.restype = None
libtaos.taos_errno.restype = ctypes.c_int
def __init__(self, config=None): def __init__(self, config=None):
''' '''
......
...@@ -110,7 +110,8 @@ class TDengineCursor(object): ...@@ -110,7 +110,8 @@ class TDengineCursor(object):
pass pass
self._result = CTaosInterface.query(self._connection._conn, stmt) 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: if CTaosInterface.fieldsCount(self._result) == 0:
self._affected_rows += CTaosInterface.affectedRows(self._result) self._affected_rows += CTaosInterface.affectedRows(self._result)
return CTaosInterface.affectedRows(self._result ) return CTaosInterface.affectedRows(self._result )
......
...@@ -149,6 +149,7 @@ class CTaosInterface(object): ...@@ -149,6 +149,7 @@ class CTaosInterface(object):
libtaos.taos_consume.restype = ctypes.c_void_p libtaos.taos_consume.restype = ctypes.c_void_p
libtaos.taos_fetch_lengths.restype = ctypes.c_void_p libtaos.taos_fetch_lengths.restype = ctypes.c_void_p
libtaos.taos_free_result.restype = None libtaos.taos_free_result.restype = None
libtaos.taos_errno.restype = ctypes.c_int
def __init__(self, config=None): def __init__(self, config=None):
''' '''
......
...@@ -110,7 +110,8 @@ class TDengineCursor(object): ...@@ -110,7 +110,8 @@ class TDengineCursor(object):
pass pass
self._result = CTaosInterface.query(self._connection._conn, stmt) 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: if CTaosInterface.fieldsCount(self._result) == 0:
self._affected_rows += CTaosInterface.affectedRows(self._result ) self._affected_rows += CTaosInterface.affectedRows(self._result )
return CTaosInterface.affectedRows(self._result ) return CTaosInterface.affectedRows(self._result )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册