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.
pull/3/head
Ashesh Vashi 2016-05-12 13:08:36 +05:30
parent 81e59be1bd
commit 7f790a7f49
1 changed files with 2 additions and 2 deletions

View File

@ -342,7 +342,7 @@ WHERE
return True, None
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:
return True, cur
@ -408,7 +408,7 @@ Attempt to reconnect it failed with the error:
else:
return False, errmsg
setattr(g, self.conn_id, cur)
setattr(g, str(self.manager.sid) + '#' + self.conn_id, cur)
return True, cur