Mercurial > cpython-lru_cache-weakref
annotate Doc/lib/sqlite3/rowclass.py @ 39496:352ffe77b71d legacy-trunk
Patch #1535500: fix segfault in BZ2File.writelines and make sure it
raises the correct exceptions.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Mon, 14 Aug 2006 21:42:55 +0000 |
| parents | cf19a123a5d9 |
| children |
| rev | line source |
|---|---|
|
38069
cf19a123a5d9
Further integration of the documentation for the sqlite3 module. There's still
Gerhard Häring <gh@ghaering.de>
parents:
diff
changeset
|
1 import sqlite3 |
|
cf19a123a5d9
Further integration of the documentation for the sqlite3 module. There's still
Gerhard Häring <gh@ghaering.de>
parents:
diff
changeset
|
2 |
|
cf19a123a5d9
Further integration of the documentation for the sqlite3 module. There's still
Gerhard Häring <gh@ghaering.de>
parents:
diff
changeset
|
3 con = sqlite3.connect("mydb") |
|
cf19a123a5d9
Further integration of the documentation for the sqlite3 module. There's still
Gerhard Häring <gh@ghaering.de>
parents:
diff
changeset
|
4 con.row_factory = sqlite3.Row |
|
cf19a123a5d9
Further integration of the documentation for the sqlite3 module. There's still
Gerhard Häring <gh@ghaering.de>
parents:
diff
changeset
|
5 |
|
cf19a123a5d9
Further integration of the documentation for the sqlite3 module. There's still
Gerhard Häring <gh@ghaering.de>
parents:
diff
changeset
|
6 cur = con.cursor() |
|
cf19a123a5d9
Further integration of the documentation for the sqlite3 module. There's still
Gerhard Häring <gh@ghaering.de>
parents:
diff
changeset
|
7 cur.execute("select name_last, age from people") |
|
cf19a123a5d9
Further integration of the documentation for the sqlite3 module. There's still
Gerhard Häring <gh@ghaering.de>
parents:
diff
changeset
|
8 for row in cur: |
|
cf19a123a5d9
Further integration of the documentation for the sqlite3 module. There's still
Gerhard Häring <gh@ghaering.de>
parents:
diff
changeset
|
9 assert row[0] == row["name_last"] |
|
cf19a123a5d9
Further integration of the documentation for the sqlite3 module. There's still
Gerhard Häring <gh@ghaering.de>
parents:
diff
changeset
|
10 assert row["name_last"] == row["nAmE_lAsT"] |
|
cf19a123a5d9
Further integration of the documentation for the sqlite3 module. There's still
Gerhard Häring <gh@ghaering.de>
parents:
diff
changeset
|
11 assert row[1] == row["age"] |
|
cf19a123a5d9
Further integration of the documentation for the sqlite3 module. There's still
Gerhard Häring <gh@ghaering.de>
parents:
diff
changeset
|
12 assert row[1] == row["AgE"] |
