[CONPY-21] Invalidate cursors if the connection was dropped Created: 2018-08-06  Updated: 2018-08-06  Resolved: 2018-08-06

Status: Closed
Project: MariaDB Connector/Python
Component/s: DBAPI 2.0
Affects Version/s: 0.9.1
Fix Version/s: 0.9.1

Type: Bug Priority: Minor
Reporter: Georg Richter Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None


 Description   

When a connection was closed or died, cursor should be invalidated/closed too.

>>> conn=mariadb.connection(user="root")
>>> cursor=conn.cursor()
>>> print(cursor.closed)
False
>>> conn.close()
>>> print(cursor.closed)
False

That means closed should be implemented as getter/setter function and should check the following conditions:

  • is connection alive
  • is statement valid
  • is statement error code==CR_STMT_CLOSED

Additionally the MARIADB_CHECK_STMT macro should also check if the error code is CR_STMT_CLOSED.


Generated at Thu Feb 08 03:29:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.