Last change
on this file was 391, checked in by dmik, 11 years ago |
python: Merge vendor 2.7.6 to trunk.
|
-
Property svn:eol-style
set to
native
|
File size:
385 bytes
|
Line | |
---|
1 | import sqlite3
|
---|
2 |
|
---|
3 | con = sqlite3.connect(":memory:")
|
---|
4 | cur = con.cursor()
|
---|
5 | cur.execute("create table people (name_last, age)")
|
---|
6 |
|
---|
7 | who = "Yeltsin"
|
---|
8 | age = 72
|
---|
9 |
|
---|
10 | # This is the qmark style:
|
---|
11 | cur.execute("insert into people values (?, ?)", (who, age))
|
---|
12 |
|
---|
13 | # And this is the named style:
|
---|
14 | cur.execute("select * from people where name_last=:who and age=:age", {"who": who, "age": age})
|
---|
15 |
|
---|
16 | print cur.fetchone()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.