summaryrefslogtreecommitdiff
path: root/doc/includes/sqlite3/executemany_2.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@futeisha.org>2013-02-04 19:20:12 +0900
committerKali Kaneko <kali@futeisha.org>2013-02-04 19:20:12 +0900
commit4189e53a881e52de0945375a72b8748143c5bd13 (patch)
tree23ed8e0600dc3c62da7a95e50f778c79a9be1e75 /doc/includes/sqlite3/executemany_2.py
initial commit
Diffstat (limited to 'doc/includes/sqlite3/executemany_2.py')
-rw-r--r--doc/includes/sqlite3/executemany_2.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/includes/sqlite3/executemany_2.py b/doc/includes/sqlite3/executemany_2.py
new file mode 100644
index 0000000..9913909
--- /dev/null
+++ b/doc/includes/sqlite3/executemany_2.py
@@ -0,0 +1,15 @@
+from pysqlite2 import dbapi2 as sqlite3
+
+def char_generator():
+ import string
+ for c in string.letters[:26]:
+ yield (c,)
+
+con = sqlite3.connect(":memory:")
+cur = con.cursor()
+cur.execute("create table characters(c)")
+
+cur.executemany("insert into characters(c) values (?)", char_generator())
+
+cur.execute("select c from characters")
+print cur.fetchall()