ยปCore Development>Code coverage>Doc/includes/sqlite3/execute_1.py

Python code coverage for Doc/includes/sqlite3/execute_1.py

#countcontent
1n/aimport sqlite3
2n/a
3n/acon = sqlite3.connect(":memory:")
4n/acur = con.cursor()
5n/acur.execute("create table people (name_last, age)")
6n/a
7n/awho = "Yeltsin"
8n/aage = 72
9n/a
10n/a# This is the qmark style:
11n/acur.execute("insert into people values (?, ?)", (who, age))
12n/a
13n/a# And this is the named style:
14n/acur.execute("select * from people where name_last=:who and age=:age", {"who": who, "age": age})
15n/a
16n/aprint(cur.fetchone())