summaryrefslogtreecommitdiffstats
path: root/Doc/includes/sqlite3/complete_statement.py
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend.aasland@protonmail.com>2022-08-12 07:34:26 (GMT)
committerGitHub <noreply@github.com>2022-08-12 07:34:26 (GMT)
commitbd86e09ab9f6f49e7c973de591187d82c5382682 (patch)
treed8343e0ec46c8def96d4daa65ce90ae02b533f26 /Doc/includes/sqlite3/complete_statement.py
parent577dbc3c49615896d5b6fbf0cb25eebd4d28624a (diff)
downloadcpython-bd86e09ab9f6f49e7c973de591187d82c5382682.zip
cpython-bd86e09ab9f6f49e7c973de591187d82c5382682.tar.gz
cpython-bd86e09ab9f6f49e7c973de591187d82c5382682.tar.bz2
[3.11] gh-95273: Improve sqlite3.complete_statement docs (GH-95840) (#95917)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com> Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>. (cherry picked from commit e6623e7083ce08a247e5df169bcc749f99327823) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Diffstat (limited to 'Doc/includes/sqlite3/complete_statement.py')
-rw-r--r--Doc/includes/sqlite3/complete_statement.py33
1 files changed, 0 insertions, 33 deletions
diff --git a/Doc/includes/sqlite3/complete_statement.py b/Doc/includes/sqlite3/complete_statement.py
deleted file mode 100644
index a5c9479..0000000
--- a/Doc/includes/sqlite3/complete_statement.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# A minimal SQLite shell for experiments
-
-import sqlite3
-
-con = sqlite3.connect(":memory:")
-con.isolation_level = None
-cur = con.cursor()
-
-buffer = ""
-
-print("Enter your SQL commands to execute in sqlite3.")
-print("Enter a blank line to exit.")
-
-while True:
- line = input()
- if line == "":
- break
- buffer += line
- if sqlite3.complete_statement(buffer):
- try:
- buffer = buffer.strip()
- cur.execute(buffer)
-
- if buffer.lstrip().upper().startswith("SELECT"):
- print(cur.fetchall())
- except sqlite3.Error as e:
- err_msg = str(e)
- err_code = e.sqlite_errorcode
- err_name = e.sqlite_errorname
- print(f"{err_name} ({err_code}): {err_msg}")
- buffer = ""
-
-con.close()