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
Prev Previous commit
fixes raw strings
dmalan committed Oct 15, 2024
commit f81a0a3920d90296537843d45683ec0b5d70171b
4 changes: 2 additions & 2 deletions src/cs50/sql.py
Original file line number Diff line number Diff line change
@@ -329,12 +329,12 @@ def execute(self, sql, *args, **kwargs):
sqlparse.tokens.Literal.String,
sqlparse.tokens.Literal.String.Single,
]:
token.value = re.sub("(^'|\s+):", r"\1\:", token.value)
token.value = re.sub(r"(^'|\s+):", r"\1\:", token.value)

# In identifier
# https://www.sqlite.org/lang_keywords.html
elif token.ttype == sqlparse.tokens.Literal.String.Symbol:
token.value = re.sub('(^"|\s+):', r"\1\:", token.value)
token.value = re.sub(r'(^"|\s+):', r"\1\:", token.value)

# Join tokens into statement
statement = "".join([str(token) for token in tokens])
Loading