add log sql command to file for python2.
This commit is contained in:
parent
cf4c4e98fd
commit
1d53387598
|
@ -34,6 +34,7 @@ class TDengineCursor(object):
|
|||
self._block_rows = -1
|
||||
self._block_iter = 0
|
||||
self._affected_rows = 0
|
||||
self._logfile = ""
|
||||
|
||||
if connection is not None:
|
||||
self._connection = connection
|
||||
|
@ -83,6 +84,9 @@ class TDengineCursor(object):
|
|||
"""
|
||||
pass
|
||||
|
||||
def log(self, logfile):
|
||||
self._logfile = logfile
|
||||
|
||||
def close(self):
|
||||
"""Close the cursor.
|
||||
"""
|
||||
|
@ -113,6 +117,11 @@ class TDengineCursor(object):
|
|||
pass
|
||||
|
||||
res = CTaosInterface.query(self._connection._conn, stmt)
|
||||
|
||||
if (self._logfile):
|
||||
with open(self._logfile, "a") as logfile:
|
||||
logfile.write("%s;\n" % operation)
|
||||
|
||||
if res == 0:
|
||||
if CTaosInterface.fieldsCount(self._connection._conn) == 0:
|
||||
self._affected_rows += CTaosInterface.affectedRows(
|
||||
|
|
Loading…
Reference in New Issue