mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-05 20:22:27 +00:00
python-3.6.zip added from Github
README.cosmo contains the necessary links.
This commit is contained in:
parent
75fc601ff5
commit
0c4c56ff39
4219 changed files with 1968626 additions and 0 deletions
30
third_party/python/Doc/includes/sqlite3/complete_statement.py
vendored
Normal file
30
third_party/python/Doc/includes/sqlite3/complete_statement.py
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
# 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:
|
||||
print("An error occurred:", e.args[0])
|
||||
buffer = ""
|
||||
|
||||
con.close()
|
Loading…
Add table
Add a link
Reference in a new issue