diff options
author | Raymond Hettinger <python@rcn.com> | 2012-04-17 15:03:20 -0400 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2012-04-17 15:03:20 -0400 |
commit | 0e15a6e24441419b5c2bb59758ee6269b29077e9 (patch) | |
tree | c2c1a9d825a729994a1cdee4935fd9880600fbbc | |
parent | f838764444baac6cd58eba2bcd0a534e84b338e5 (diff) | |
download | cpython-git-0e15a6e24441419b5c2bb59758ee6269b29077e9.tar.gz |
Clarify that a new connection needs to be made after the close.
-rw-r--r-- | Doc/library/sqlite3.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 0745cefe37..f7aca70601 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -51,6 +51,12 @@ Usually your SQL operations will need to use values from Python variables. You shouldn't assemble your query using Python's string operations because doing so is insecure; it makes your program vulnerable to an SQL injection attack. +The data you've saved is persistent and is available in subsequent sessions:: + + import sqlite3 + conn = sqlite3.connect('/tmp/example') + c = conn.cursor() + Instead, use the DB-API's parameter substitution. Put ``?`` as a placeholder wherever you want to use a value, and then provide a tuple of values as the second argument to the cursor's :meth:`~Cursor.execute` method. (Other database |