Skip to content

Commit 2f9459c

Browse files
authored
Enable match statements sqlite cli (#5919)
1 parent 3413415 commit 2f9459c

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

Lib/sqlite3/__main__.py

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,30 +48,18 @@ def runsource(self, source, filename="<input>", symbol="single"):
4848
Return True if more input is needed; buffering is done automatically.
4949
Return False is input is a complete statement ready for execution.
5050
"""
51-
if source == ".version":
52-
print(f"{sqlite3.sqlite_version}")
53-
elif source == ".help":
54-
print("Enter SQL code and press enter.")
55-
elif source == ".quit":
56-
sys.exit(0)
57-
elif not sqlite3.complete_statement(source):
58-
return True
59-
else:
60-
execute(self._cur, source)
61-
return False
62-
# TODO: RUSTPYTHON match statement supporting
63-
# match source:
64-
# case ".version":
65-
# print(f"{sqlite3.sqlite_version}")
66-
# case ".help":
67-
# print("Enter SQL code and press enter.")
68-
# case ".quit":
69-
# sys.exit(0)
70-
# case _:
71-
# if not sqlite3.complete_statement(source):
72-
# return True
73-
# execute(self._cur, source)
74-
# return False
51+
match source:
52+
case ".version":
53+
print(f"{sqlite3.sqlite_version}")
54+
case ".help":
55+
print("Enter SQL code and press enter.")
56+
case ".quit":
57+
sys.exit(0)
58+
case _:
59+
if not sqlite3.complete_statement(source):
60+
return True
61+
execute(self._cur, source)
62+
return False
7563

7664

7765
def main():

0 commit comments

Comments
 (0)