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

Correctly detect empty string literals ('') in SQL source #78

Merged
merged 2 commits into from
Dec 24, 2021

Conversation

mitya57
Copy link
Contributor

@mitya57 mitya57 commented Sep 16, 2021

In our project we had a query with the following line:

AND LOWER(REGEXP_REPLACE(company_name,'\W','','g')) = LOWER(REGEXP_REPLACE(:companyName,'\W','','g'))

aiosql did not detect the empty string literal '' properly. So it treated the closing ' as an opening quote, and then it treated ')) = LOWER(REGEXP_REPLACE(:companyName,' as a string literal. Because of this, :companyName was not substituted in it.

@nackjicholson
Copy link
Owner

@mitya57 Nice catch. I'll try to check this out sometime. Looks like all current tests work, but might want to add one that covers the case you hit here

@nackjicholson
Copy link
Owner

@mitya57 I added a new test based on your example. Thank you for providing an example of the use case, and thank you for your contribution!

@nackjicholson nackjicholson merged commit 8ed56e9 into nackjicholson:master Dec 24, 2021
@mitya57 mitya57 deleted the empty-string-literals branch December 25, 2021 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants