sqlite3: Port relevant documentation changes from 3.2

Initial patch by Johannes Vogel. Issue #13491.
This commit is contained in:
Petri Lehtinen 2012-03-01 21:28:00 +02:00
parent c56bca31e9
commit a15a8d2a0c
8 changed files with 36 additions and 48 deletions

View file

@ -1,11 +1,16 @@
import sqlite3
con = sqlite3.connect("mydb")
con = sqlite3.connect(":memory:")
cur = con.cursor()
cur.execute("create table people (name_last, age)")
who = "Yeltsin"
age = 72
cur.execute("select name_last, age from people where name_last=? and age=?", (who, age))
# This is the qmark style:
cur.execute("insert into people values (?, ?)", (who, age))
# And this is the named style:
cur.execute("select * from people where name_last=:who and age=:age", {"who": who, "age": age})
print cur.fetchone()