Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for VACUUM, fixes raw strings #186

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
adds support for VACUUM
dmalan committed Oct 15, 2024
commit 2d5fd94132accb2733833eb273d755803a99794c
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -18,5 +18,5 @@
package_dir={"": "src"},
packages=["cs50"],
url="https://github.com/cs50/python-cs50",
version="9.3.4"
version="9.4.0"
)
5 changes: 3 additions & 2 deletions src/cs50/sql.py
Original file line number Diff line number Diff line change
@@ -177,6 +177,7 @@ def execute(self, sql, *args, **kwargs):
"SELECT",
"START",
"UPDATE",
"VACUUM",
}

# Check if the full_statement starts with any command
@@ -378,7 +379,7 @@ def teardown_appcontext(exception):
)

# Check for start of transaction
if command in ["BEGIN", "START"]:
if command in ["BEGIN", "START", "VACUUM"]: # cannot VACUUM from within a transaction
self._autocommit = False

# Execute statement
@@ -389,7 +390,7 @@ def teardown_appcontext(exception):
connection.execute(sqlalchemy.text("COMMIT"))

# Check for end of transaction
if command in ["COMMIT", "ROLLBACK"]:
if command in ["COMMIT", "ROLLBACK", "VACUUM"]: # cannot VACUUM from within a transaction
self._autocommit = True

# Return value