From 21cc09f8a605908f71b07e7b463a0eac74265034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Wed, 29 Apr 2020 06:00:23 +0200 Subject: [PATCH] SQLite --- README.md | 9 +++++---- index.html | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c850026..fe7dd80 100644 --- a/README.md +++ b/README.md @@ -1874,12 +1874,13 @@ db.executemany('', ) # Runs execute() many times. ### Example **In this example values are not actually saved because `'db.commit()'` is omitted!** + ```python >>> db = sqlite3.connect('test.db') ->>> db.execute('create table t (a, b, c)') ->>> db.execute('insert into t values (1, 2, 3)') ->>> db.execute('select * from t').fetchall() -[(1, 2, 3)] +>>> db.execute('create table person (id integer primary key, name, height)') +>>> db.execute('insert into person values (null, ?, ?)', ('Jean-Luc', 187)) +>>> db.execute('select * from person').fetchall() +[(1, 'Jean-Luc', 187)] ``` ### MySQL diff --git a/index.html b/index.html index 7124d45..bf4d6da 100644 --- a/index.html +++ b/index.html @@ -1674,10 +1674,10 @@ db.executemany('<query>', <coll_of_abo

Example

In this example values are not actually saved because 'db.commit()' is omitted!

>>> db = sqlite3.connect('test.db')
->>> db.execute('create table t (a, b, c)')
->>> db.execute('insert into t values (1, 2, 3)')
->>> db.execute('select * from t').fetchall()
-[(1, 2, 3)]
+>>> db.execute('create table person (id integer primary key, name, height)')
+>>> db.execute('insert into person values (null, ?, ?)', ('Jean-Luc', 187))
+>>> db.execute('select * from person').fetchall()
+[(1, 'Jean-Luc', 187)]