summaryrefslogtreecommitdiffstats
path: root/Doc/includes/sqlite3
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-05-19 08:17:19 (GMT)
committerGitHub <noreply@github.com>2021-05-19 08:17:19 (GMT)
commite57bef1b73abb8e89d927053bd7e4fdbf44687bf (patch)
treeb85aa8b36dea84cfa97b1e6f79ab64b7bfb1370f /Doc/includes/sqlite3
parent3185bc9d3f38ce9d814aecf8104f1d6953c2d8ff (diff)
downloadcpython-e57bef1b73abb8e89d927053bd7e4fdbf44687bf.zip
cpython-e57bef1b73abb8e89d927053bd7e4fdbf44687bf.tar.gz
cpython-e57bef1b73abb8e89d927053bd7e4fdbf44687bf.tar.bz2
bpo-44106: Purge unused sqlite3 doc includes (GH-26234)
(cherry picked from commit d798acc8733b605f7fc9c3c1a85cd14ee2a56add) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Diffstat (limited to 'Doc/includes/sqlite3')
-rw-r--r--Doc/includes/sqlite3/countcursors.py17
-rw-r--r--Doc/includes/sqlite3/createdb.py28
-rw-r--r--Doc/includes/sqlite3/execsql_fetchonerow.py19
-rw-r--r--Doc/includes/sqlite3/execsql_printall_1.py15
-rw-r--r--Doc/includes/sqlite3/insert_more_langs.py18
-rw-r--r--Doc/includes/sqlite3/parse_colnames.py10
-rw-r--r--Doc/includes/sqlite3/shared_cache.py6
-rw-r--r--Doc/includes/sqlite3/simple_tableprinter.py25
8 files changed, 0 insertions, 138 deletions
diff --git a/Doc/includes/sqlite3/countcursors.py b/Doc/includes/sqlite3/countcursors.py
deleted file mode 100644
index 112f477..0000000
--- a/Doc/includes/sqlite3/countcursors.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import sqlite3
-
-class CountCursorsConnection(sqlite3.Connection):
- def __init__(self, *args, **kwargs):
- sqlite3.Connection.__init__(self, *args, **kwargs)
- self.numcursors = 0
-
- def cursor(self, *args, **kwargs):
- self.numcursors += 1
- return sqlite3.Connection.cursor(self, *args, **kwargs)
-
-con = sqlite3.connect(":memory:", factory=CountCursorsConnection)
-cur1 = con.cursor()
-cur2 = con.cursor()
-print(con.numcursors)
-
-con.close()
diff --git a/Doc/includes/sqlite3/createdb.py b/Doc/includes/sqlite3/createdb.py
deleted file mode 100644
index 4970212..0000000
--- a/Doc/includes/sqlite3/createdb.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Not referenced from the documentation, but builds the database file the other
-# code snippets expect.
-
-import sqlite3
-import os
-
-DB_FILE = "mydb"
-
-if os.path.exists(DB_FILE):
- os.remove(DB_FILE)
-
-con = sqlite3.connect(DB_FILE)
-cur = con.cursor()
-cur.execute("""
- create table lang
- (
- name varchar(20),
- first_appeared integer
- )
- """)
-
-cur.execute("insert into lang (name, first_appeared) values ('Forth', 1970)")
-cur.execute("insert into lang (name, first_appeared) values ('Ada', 1980)")
-
-con.commit()
-
-cur.close()
-con.close()
diff --git a/Doc/includes/sqlite3/execsql_fetchonerow.py b/Doc/includes/sqlite3/execsql_fetchonerow.py
deleted file mode 100644
index 0ca7e14..0000000
--- a/Doc/includes/sqlite3/execsql_fetchonerow.py
+++ /dev/null
@@ -1,19 +0,0 @@
-import sqlite3
-
-con = sqlite3.connect("mydb")
-
-cur = con.cursor()
-SELECT = "select name, first_appeared from people order by first_appeared, name"
-
-# 1. Iterate over the rows available from the cursor, unpacking the
-# resulting sequences to yield their elements (name, first_appeared):
-cur.execute(SELECT)
-for name, first_appeared in cur:
- print(f"The {name} programming language appeared in {first_appeared}.")
-
-# 2. Equivalently:
-cur.execute(SELECT)
-for row in cur:
- print(f"The {row[0]} programming language appeared in {row[1]}.")
-
-con.close()
diff --git a/Doc/includes/sqlite3/execsql_printall_1.py b/Doc/includes/sqlite3/execsql_printall_1.py
deleted file mode 100644
index b3b42b5..0000000
--- a/Doc/includes/sqlite3/execsql_printall_1.py
+++ /dev/null
@@ -1,15 +0,0 @@
-import sqlite3
-
-# Create a connection to the database file "mydb":
-con = sqlite3.connect("mydb")
-
-# Get a Cursor object that operates in the context of Connection con:
-cur = con.cursor()
-
-# Execute the SELECT statement:
-cur.execute("select * from lang order by first_appeared")
-
-# Retrieve all rows as a sequence and print that sequence:
-print(cur.fetchall())
-
-con.close()
diff --git a/Doc/includes/sqlite3/insert_more_langs.py b/Doc/includes/sqlite3/insert_more_langs.py
deleted file mode 100644
index ceef949..0000000
--- a/Doc/includes/sqlite3/insert_more_langs.py
+++ /dev/null
@@ -1,18 +0,0 @@
-import sqlite3
-
-con = sqlite3.connect("mydb")
-
-cur = con.cursor()
-
-languages = (
- ("Smalltalk", 1972),
- ("Swift", 2014),
-)
-
-for lang in languages:
- cur.execute("insert into lang (name, first_appeared) values (?, ?)", lang)
-
-# The changes will not be saved unless the transaction is committed explicitly:
-con.commit()
-
-con.close()
diff --git a/Doc/includes/sqlite3/parse_colnames.py b/Doc/includes/sqlite3/parse_colnames.py
deleted file mode 100644
index 5f01dbf..0000000
--- a/Doc/includes/sqlite3/parse_colnames.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import sqlite3
-import datetime
-
-con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_COLNAMES)
-cur = con.cursor()
-cur.execute('select ? as "x [timestamp]"', (datetime.datetime.now(),))
-dt = cur.fetchone()[0]
-print(dt, type(dt))
-
-con.close()
diff --git a/Doc/includes/sqlite3/shared_cache.py b/Doc/includes/sqlite3/shared_cache.py
deleted file mode 100644
index 30e71c9..0000000
--- a/Doc/includes/sqlite3/shared_cache.py
+++ /dev/null
@@ -1,6 +0,0 @@
-import sqlite3
-
-# The shared cache is only available in SQLite versions 3.3.3 or later
-# See the SQLite documentation for details.
-
-sqlite3.enable_shared_cache(True)
diff --git a/Doc/includes/sqlite3/simple_tableprinter.py b/Doc/includes/sqlite3/simple_tableprinter.py
deleted file mode 100644
index 9be6e4f..0000000
--- a/Doc/includes/sqlite3/simple_tableprinter.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import sqlite3
-
-FIELD_MAX_WIDTH = 20
-
-con = sqlite3.connect("mydb")
-cur = con.cursor()
-cur.execute("select * from lang order by name, first_appeared")
-
-# Print a header.
-for fieldDesc in cur.description:
- print(fieldDesc[0].ljust(FIELD_MAX_WIDTH), end=' ')
-print() # Finish the header with a newline.
-print('-' * 78)
-
-# For each row, print the value of each field left-justified within
-# the maximum possible width of that field.
-fieldIndices = range(len(cur.description))
-for row in cur:
- for fieldIndex in fieldIndices:
- fieldValue = str(row[fieldIndex])
- print(fieldValue.ljust(FIELD_MAX_WIDTH), end=' ')
-
- print() # Finish the row with a newline.
-
-con.close()