summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-11-06 10:19:11 (GMT)
committerGeorg Brandl <georg@python.org>2008-11-06 10:19:11 (GMT)
commitb9bfea712f760cf0ba9bb672c297039a31d65188 (patch)
tree9e63b0107b5edb09eae8f170fc63b539145c9ec2 /Doc
parent8986706efa071483aa669f51b7c7c7b2ca002d22 (diff)
downloadcpython-b9bfea712f760cf0ba9bb672c297039a31d65188.zip
cpython-b9bfea712f760cf0ba9bb672c297039a31d65188.tar.gz
cpython-b9bfea712f760cf0ba9bb672c297039a31d65188.tar.bz2
#4267: small fixes in sqlite3 docs.
Diffstat (limited to 'Doc')
-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 1420ad7..6235f9e 100644
--- a/Doc/library/sqlite3.rst
+++ b/Doc/library/sqlite3.rst
@@ -64,10 +64,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
@@ -426,10 +426,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:
@@ -813,8 +812,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".