summaryrefslogtreecommitdiffstats
path: root/Doc/library/sqlite3.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-11-07 09:39:56 (GMT)
committerGeorg Brandl <georg@python.org>2008-11-07 09:39:56 (GMT)
commita971c65f1dfc5eb02749456dac917686b3cb09c4 (patch)
tree44b1616530ac69a8329b0cd5306faa7699aaf5b6 /Doc/library/sqlite3.rst
parent6570d071faca9cc5f8abbe3163969b8c0b0d76b4 (diff)
downloadcpython-a971c65f1dfc5eb02749456dac917686b3cb09c4.zip
cpython-a971c65f1dfc5eb02749456dac917686b3cb09c4.tar.gz
cpython-a971c65f1dfc5eb02749456dac917686b3cb09c4.tar.bz2
Merged revisions 67117-67119,67123-67124,67143 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r67117 | georg.brandl | 2008-11-06 11:17:58 +0100 (Thu, 06 Nov 2008) | 2 lines #4268: Use correct module for two toplevel functions. ........ r67118 | georg.brandl | 2008-11-06 11:19:11 +0100 (Thu, 06 Nov 2008) | 2 lines #4267: small fixes in sqlite3 docs. ........ r67119 | georg.brandl | 2008-11-06 11:20:49 +0100 (Thu, 06 Nov 2008) | 2 lines #4245: move Thread section to the top. ........ r67123 | georg.brandl | 2008-11-06 19:49:15 +0100 (Thu, 06 Nov 2008) | 2 lines #4247: add "pass" examples to tutorial. ........ r67124 | andrew.kuchling | 2008-11-06 20:23:02 +0100 (Thu, 06 Nov 2008) | 1 line Fix grammar error; reword two paragraphs ........ r67143 | georg.brandl | 2008-11-07 09:27:39 +0100 (Fri, 07 Nov 2008) | 2 lines Fix syntax. ........
Diffstat (limited to 'Doc/library/sqlite3.rst')
-rw-r--r--Doc/library/sqlite3.rst15
1 files changed, 7 insertions, 8 deletions
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst
index 8ffbce3..5a22ae4 100644
--- a/Doc/library/sqlite3.rst
+++ b/Doc/library/sqlite3.rst
@@ -62,10 +62,10 @@ may use a different placeholder, such as ``%s`` or ``:1``.) For example::
c.execute('select * from stocks where symbol=?', t)
# Larger example
- for t in (('2006-03-28', 'BUY', 'IBM', 1000, 45.00),
+ for t in [('2006-03-28', 'BUY', 'IBM', 1000, 45.00),
('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00),
('2006-04-06', 'SELL', 'IBM', 500, 53.00),
- ):
+ ]:
c.execute('insert into stocks values (?,?,?,?,?)', t)
To retrieve data after executing a SELECT statement, you can either treat the
@@ -421,10 +421,9 @@ Connection Objects
import sqlite3, os
con = sqlite3.connect('existing_db.db')
- full_dump = os.linesep.join(con.iterdump())
- f = open('dump.sql', 'w')
- f.writelines(full_dump)
- f.close()
+ with open('dump.sql', 'w') as f:
+ for line in con.iterdump():
+ f.write('%s\n' % line)
.. _sqlite3-cursor-objects:
@@ -800,8 +799,8 @@ call, or via the :attr:`isolation_level` property of connections.
If you want **autocommit mode**, then set :attr:`isolation_level` to None.
Otherwise leave it at its default, which will result in a plain "BEGIN"
-statement, or set it to one of SQLite's supported isolation levels: DEFERRED,
-IMMEDIATE or EXCLUSIVE.
+statement, or set it to one of SQLite's supported isolation levels: "DEFERRED",
+"IMMEDIATE" or "EXCLUSIVE".