You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, forgive me if I'm getting this completely wrong, since I'm a novice programmer.
Within the _query function, a check is performed to see if there is a connection object available. If there isn't a new one is created.
if conn is None: if self.conn is None: conn = connection.Connection() else: conn = self.conn
The comments in the code state
If not provided, opens a new connection for this and all
subsequent queries.
However from looking at this code, it seems to me that the connection object would not be re-used for future queries, since it is being assigned to a local reference 'conn' which will be destroyed when the function exits. Therefore each time the function is called a new connection object is created?
Wouldn't the code be something like: if conn is None: if self.conn is None: self.conn = connection.Connection() else: conn = self.conn
The text was updated successfully, but these errors were encountered:
Hi, forgive me if I'm getting this completely wrong, since I'm a novice programmer.
Within the _query function, a check is performed to see if there is a connection object available. If there isn't a new one is created.
if conn is None: if self.conn is None: conn = connection.Connection() else: conn = self.conn
The comments in the code state
However from looking at this code, it seems to me that the connection object would not be re-used for future queries, since it is being assigned to a local reference 'conn' which will be destroyed when the function exits. Therefore each time the function is called a new connection object is created?
Wouldn't the code be something like:
if conn is None: if self.conn is None: self.conn = connection.Connection() else: conn = self.conn
The text was updated successfully, but these errors were encountered: