Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1)

Unified Diff: Doc/library/sqlite3.rst

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Doc/library/socketserver.rst ('k') | Doc/library/ssl.rst » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Doc/library/sqlite3.rst Tue Jul 26 09:37:46 2011 +0300
+++ b/Doc/library/sqlite3.rst Mon Jul 25 09:47:18 2011 -0400
@@ -615,43 +615,43 @@
Let's assume we initialize a table as in the example given above::
- conn = sqlite3.connect(":memory:")
- c = conn.cursor()
- c.execute('''create table stocks
- (date text, trans text, symbol text,
- qty real, price real)''')
- c.execute("""insert into stocks
- values ('2006-01-05','BUY','RHAT',100,35.14)""")
- conn.commit()
- c.close()
+ conn = sqlite3.connect(":memory:")
+ c = conn.cursor()
+ c.execute('''create table stocks
+ (date text, trans text, symbol text,
+ qty real, price real)''')
+ c.execute("""insert into stocks
+ values ('2006-01-05','BUY','RHAT',100,35.14)""")
+ conn.commit()
+ c.close()
Now we plug :class:`Row` in::
- >>> conn.row_factory = sqlite3.Row
- >>> c = conn.cursor()
- >>> c.execute('select * from stocks')
- <sqlite3.Cursor object at 0x7f4e7dd8fa80>
- >>> r = c.fetchone()
- >>> type(r)
- <class 'sqlite3.Row'>
- >>> tuple(r)
- ('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14)
- >>> len(r)
- 5
- >>> r[2]
- 'RHAT'
- >>> r.keys()
- ['date', 'trans', 'symbol', 'qty', 'price']
- >>> r['qty']
- 100.0
- >>> for member in r:
- ... print(member)
- ...
- 2006-01-05
- BUY
- RHAT
- 100.0
- 35.14
+ >>> conn.row_factory = sqlite3.Row
+ >>> c = conn.cursor()
+ >>> c.execute('select * from stocks')
+ <sqlite3.Cursor object at 0x7f4e7dd8fa80>
+ >>> r = c.fetchone()
+ >>> type(r)
+ <class 'sqlite3.Row'>
+ >>> tuple(r)
+ ('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14)
+ >>> len(r)
+ 5
+ >>> r[2]
+ 'RHAT'
+ >>> r.keys()
+ ['date', 'trans', 'symbol', 'qty', 'price']
+ >>> r['qty']
+ 100.0
+ >>> for member in r:
+ ... print(member)
+ ...
+ 2006-01-05
+ BUY
+ RHAT
+ 100.0
+ 35.14
.. _sqlite3-types:
@@ -902,7 +902,6 @@
.. rubric:: Footnotes
.. [#f1] The sqlite3 module is not built with loadable extension support by
- default, because some platforms (notably Mac OS X) have SQLite
- libraries which are compiled without this feature. To get loadable
- extension support, you must pass --enable-loadable-sqlite-extensions to
- configure.
+ default, because some platforms (notably Mac OS X) have SQLite libraries which
+ are compiled without this feature. To get loadable extension support, you must
+ pass --enable-loadable-sqlite-extensions to configure.
« no previous file with comments | « Doc/library/socketserver.rst ('k') | Doc/library/ssl.rst » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+