reST indentation fix in sqlite3 docs. rst uses 3 space indentation.

This commit is contained in:
Senthil Kumaran 2011-07-03 10:17:22 -07:00
parent 187c111a55
commit 946eb865a3

View File

@ -599,43 +599,43 @@ Row Objects
Let's assume we initialize a table as in the example given above:: Let's assume we initialize a table as in the example given above::
conn = sqlite3.connect(":memory:") conn = sqlite3.connect(":memory:")
c = conn.cursor() c = conn.cursor()
c.execute('''create table stocks c.execute('''create table stocks
(date text, trans text, symbol text, (date text, trans text, symbol text,
qty real, price real)''') qty real, price real)''')
c.execute("""insert into stocks c.execute("""insert into stocks
values ('2006-01-05','BUY','RHAT',100,35.14)""") values ('2006-01-05','BUY','RHAT',100,35.14)""")
conn.commit() conn.commit()
c.close() c.close()
Now we plug :class:`Row` in:: Now we plug :class:`Row` in::
>>> conn.row_factory = sqlite3.Row >>> conn.row_factory = sqlite3.Row
>>> c = conn.cursor() >>> c = conn.cursor()
>>> c.execute('select * from stocks') >>> c.execute('select * from stocks')
<sqlite3.Cursor object at 0x7f4e7dd8fa80> <sqlite3.Cursor object at 0x7f4e7dd8fa80>
>>> r = c.fetchone() >>> r = c.fetchone()
>>> type(r) >>> type(r)
<class 'sqlite3.Row'> <class 'sqlite3.Row'>
>>> tuple(r) >>> tuple(r)
('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14) ('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14)
>>> len(r) >>> len(r)
5 5
>>> r[2] >>> r[2]
'RHAT' 'RHAT'
>>> r.keys() >>> r.keys()
['date', 'trans', 'symbol', 'qty', 'price'] ['date', 'trans', 'symbol', 'qty', 'price']
>>> r['qty'] >>> r['qty']
100.0 100.0
>>> for member in r: >>> for member in r:
... print(member) ... print(member)
... ...
2006-01-05 2006-01-05
BUY BUY
RHAT RHAT
100.0 100.0
35.14 35.14
.. _sqlite3-types: .. _sqlite3-types:
@ -886,6 +886,7 @@ only makes sense to call from a different thread.
.. rubric:: Footnotes .. rubric:: Footnotes
.. [#f1] The sqlite3 module is not built with loadable extension support by .. [#f1] The sqlite3 module is not built with loadable extension support by
default, because some platforms (notably Mac OS X) have SQLite libraries which default, because some platforms (notably Mac OS X) have SQLite
are compiled without this feature. To get loadable extension support, you must libraries which are compiled without this feature. To get loadable
pass --enable-loadable-sqlite-extensions to configure. extension support, you must pass --enable-loadable-sqlite-extensions to
configure.