]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Show how to close a connection
authorRaymond Hettinger <python@rcn.com>
Tue, 25 Sep 2012 23:57:50 +0000 (19:57 -0400)
committerRaymond Hettinger <python@rcn.com>
Tue, 25 Sep 2012 23:57:50 +0000 (19:57 -0400)
Doc/library/sqlite3.rst

index 978b7603ee5e9894b65cb93ec9cfbc390fad1133..1ff75f05f14fccca505fb7cbd9f3ea16eb74612c 100644 (file)
@@ -42,8 +42,9 @@ and call its :meth:`~Cursor.execute` method to perform SQL commands::
    # Save (commit) the changes
    conn.commit()
 
-   # We can also close the cursor if we are done with it
-   c.close()
+   # We can also close the connection if we are done with it.
+   # Just be sure any changes have been committed or they will be lost.
+   conn.close()
 
 The data you've saved is persistent and is available in subsequent sessions::