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

Adding proper escape #87

Merged
merged 4 commits into from
Feb 22, 2024
Merged

Adding proper escape #87

merged 4 commits into from
Feb 22, 2024

Conversation

mroda88
Copy link
Collaborator

@mroda88 mroda88 commented Feb 22, 2024

No description provided.

@mroda88 mroda88 self-assigned this Feb 22, 2024
@mroda88 mroda88 added the bug Something isn't working label Feb 22, 2024

command = f'INSERT INTO {table_name} ({",".join(fields)}) VALUES ({("%s, " * len(values))[:-2]});'
logging.debug(command)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you also want to escape field names here. Also why do you need the [:-2]?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

escape the fields, and the table_name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the [:-2] is to remove the last comma and the last from the string. I'll escape the rest too.

@mroda88 mroda88 merged commit 46e5d63 into develop Feb 22, 2024
@mroda88 mroda88 deleted the mroda/escaping branch February 22, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants