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

[Bug]: Backslash \ needs to be handled explicitly in MySQL. #2499

Open
1 task done
abhishekkumams opened this issue Dec 18, 2024 · 0 comments
Open
1 task done

[Bug]: Backslash \ needs to be handled explicitly in MySQL. #2499

abhishekkumams opened this issue Dec 18, 2024 · 0 comments
Labels
bug Something isn't working mysql an issue thats specific to mysql triage issues to be triaged

Comments

@abhishekkumams
Copy link
Contributor

What happened?

https://bugs.mysql.com/bug.php?id=10489
https://stackoverflow.com/questions/14926386/how-can-i-search-for-slash-in-mysql-and-why-is-escaping-not-required-fo

Image

Version

main

What database are you using?

MySQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

GraphQL, REST

Relevant log output


Code of Conduct

  • I agree to follow this project's Code of Conduct
@abhishekkumams abhishekkumams added bug Something isn't working mysql an issue thats specific to mysql triage issues to be triaged labels Dec 18, 2024
abhishekkumams added a commit that referenced this issue Jan 22, 2025
## Why make this change?

- Closes #2434 
- when wildcard characters are used as literal character in search,
filter query fails to resolve correctly.
- we never use the wild characters of SQL for their intended use as wild
characters when queried from GraphQL. They are always used as literal
search characters.

## What is this change?
- we are adding `\` whenever a special character (wildcard) is used in
the filter query.
- while mysql,pgsql are able to understand and treat `\` as escape
charachters, for MsSQL, we have to use `ESCAPE` clause.
- The `ESCAPE` clause in a `LIKE` query specifies a character to treat
as an escape character. This is especially useful when your search
pattern contains special characters like %, _, or the actual escape
character, which otherwise have special meanings in LIKE patterns.
- I have updated the query builder for MsSql, which checks if it is a
`LIKE` query and only then it adds an `ESCAPE` clause.

There is a special case for mysql for wildcard (`\`), which needs to be
handled separately. I have created an issue to tackle it. #2499

## How was this tested?

- [X] Integration Tests
- [x] manual tests

## Sample Request(s)

![image](https://github.com/user-attachments/assets/9c283f6c-6443-4dee-bb45-d0d71b109420)

![image](https://github.com/user-attachments/assets/4a0f74df-8eaa-4ff9-b034-edf3ce058cda)

![image](https://github.com/user-attachments/assets/c7ae22a1-da7d-41bf-91ae-7190e5abcaf3)

---------

Co-authored-by: Aniruddh Munde <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mysql an issue thats specific to mysql triage issues to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant