Use the same cursor object of a connection object only from the same

server.

Current implementation keeps the cursor object in the 'g' (current
request context) object identified by the connection-id.
But - it fails to identify a different connection object request, when
we have same database name in different database server, it does not
able to identify it as separate request, Hence - now we will use
server-id qualified identifier for the same object.

Thanks Neel Patel for pointing out the issue.
This commit is contained in:
Ashesh Vashi 2016-05-12 13:08:36 +05:30
parent 81e59be1bd
commit 7f790a7f49

View File

@ -342,7 +342,7 @@ WHERE
return True, None return True, None
def __cursor(self): def __cursor(self):
cur = getattr(g, self.conn_id, None) cur = getattr(g, str(self.manager.sid) + '#' + self.conn_id, None)
if self.connected() and cur and not cur.closed: if self.connected() and cur and not cur.closed:
return True, cur return True, cur
@ -408,7 +408,7 @@ Attempt to reconnect it failed with the error:
else: else:
return False, errmsg return False, errmsg
setattr(g, self.conn_id, cur) setattr(g, str(self.manager.sid) + '#' + self.conn_id, cur)
return True, cur return True, cur