[TD-785]check the caller and creater, if not match, return none
This commit is contained in:
parent
6cb97b3730
commit
496932f0cc
|
@ -1,6 +1,7 @@
|
||||||
from .cinterface import CTaosInterface
|
from .cinterface import CTaosInterface
|
||||||
from .error import *
|
from .error import *
|
||||||
from .constants import FieldType
|
from .constants import FieldType
|
||||||
|
import threading
|
||||||
|
|
||||||
# querySeqNum = 0
|
# querySeqNum = 0
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ class TDengineCursor(object):
|
||||||
self._block_iter = 0
|
self._block_iter = 0
|
||||||
self._affected_rows = 0
|
self._affected_rows = 0
|
||||||
self._logfile = ""
|
self._logfile = ""
|
||||||
|
self._threadId = threading.get_ident()
|
||||||
|
|
||||||
if connection is not None:
|
if connection is not None:
|
||||||
self._connection = connection
|
self._connection = connection
|
||||||
|
@ -103,6 +105,11 @@ class TDengineCursor(object):
|
||||||
def execute(self, operation, params=None):
|
def execute(self, operation, params=None):
|
||||||
"""Prepare and execute a database operation (query or command).
|
"""Prepare and execute a database operation (query or command).
|
||||||
"""
|
"""
|
||||||
|
if threading.get_ident() != self._threadId:
|
||||||
|
info ="Cursor execute:Thread ID not match,creater:"+str(self._threadId)+" caller:"+str(threading.get_ident())
|
||||||
|
print(info)
|
||||||
|
return None
|
||||||
|
|
||||||
if not operation:
|
if not operation:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -188,6 +195,10 @@ class TDengineCursor(object):
|
||||||
def fetchall(self):
|
def fetchall(self):
|
||||||
"""Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e.g. a list of tuples). Note that the cursor's arraysize attribute can affect the performance of this operation.
|
"""Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e.g. a list of tuples). Note that the cursor's arraysize attribute can affect the performance of this operation.
|
||||||
"""
|
"""
|
||||||
|
if threading.get_ident() != self._threadId:
|
||||||
|
info ="Cursor fetchall:Thread ID not match,creater:"+str(self._threadId)+" caller:"+str(threading.get_ident())
|
||||||
|
print(info)
|
||||||
|
return None
|
||||||
if self._result is None or self._fields is None:
|
if self._result is None or self._fields is None:
|
||||||
raise OperationalError("Invalid use of fetchall")
|
raise OperationalError("Invalid use of fetchall")
|
||||||
|
|
||||||
|
@ -232,6 +243,11 @@ class TDengineCursor(object):
|
||||||
def _handle_result(self):
|
def _handle_result(self):
|
||||||
"""Handle the return result from query.
|
"""Handle the return result from query.
|
||||||
"""
|
"""
|
||||||
|
if threading.get_ident() != self._threadId:
|
||||||
|
info = "Cursor handleresult:Thread ID not match,creater:"+str(self._threadId)+" caller:"+str(threading.get_ident())
|
||||||
|
print(info)
|
||||||
|
return None
|
||||||
|
|
||||||
self._description = []
|
self._description = []
|
||||||
for ele in self._fields:
|
for ele in self._fields:
|
||||||
self._description.append(
|
self._description.append(
|
||||||
|
|
Loading…
Reference in New Issue