Skip to content

QuoteString() only escapes the first special character of each type in a string #25

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

Closed
zachary-D opened this issue Apr 11, 2020 · 1 comment · Fixed by #26
Closed

QuoteString() only escapes the first special character of each type in a string #25

zachary-D opened this issue Apr 11, 2020 · 1 comment · Fixed by #26

Comments

@zachary-D
Copy link
Contributor

QuoteString() uses the string.replace() method to escape special characters, but passes the patterns to it as strings. When the pattern is given as a string, only the first instance of the pattern is replaced.

The patterns need to be converted to regex patterns/objects in order for every instance to be replaced properly. For example, string = string.replace("'", "''"); becomes string = string.replace(/'/g, "''");.

I'm preparing a PR and will be submitting it soon if you'd be willing to accept it.

thiagodp added a commit that referenced this issue Apr 21, 2020
…acter-is-escaped

fix: #25 an issue where only the first special character of each type would be escaped when building queries
@thiagodp
Copy link
Collaborator

Thank you, @zachary-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants