summaryrefslogtreecommitdiffstats
path: root/Doc/includes/sqlite3/ctx_manager.py
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/includes/sqlite3/ctx_manager.py')
-rw-r--r--Doc/includes/sqlite3/ctx_manager.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/includes/sqlite3/ctx_manager.py b/Doc/includes/sqlite3/ctx_manager.py
index 7af4ad1..6db77d4 100644
--- a/Doc/includes/sqlite3/ctx_manager.py
+++ b/Doc/includes/sqlite3/ctx_manager.py
@@ -14,3 +14,7 @@ try:
con.execute("insert into person(firstname) values (?)", ("Joe",))
except sqlite3.IntegrityError:
print("couldn't add Joe twice")
+
+# Connection object used as context manager only commits or rollbacks transactions,
+# so the connection object should be closed manually
+con.close()