FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Doc/includes/sqlite3/complete_statement.py at 3.7 · python-emscripten/cpython · GitHub
python-emscripten
cpython
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
Doc
/
includes
/
sqlite3
/
complete_statement.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
30 lines (23 loc) · 672 Bytes
Breadcrumbs
cpython
/
Doc
/
includes
/
sqlite3
/
complete_statement.py
Copy path
File metadata and controls
30 lines (23 loc) · 672 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
()
Back
|
FazBrowse Home
|
New Git URL