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

Fix LIKE and NOT LIKE Queries for Strings #162

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jsievenpiper
Copy link
Contributor

PR Info

This is a quick patch that fixes LIKE and NOT LIKE queries, which as far as I can tell, have never worked in seaography. The underlying sea_orm code works, but when stringifying the already String value, sea_orm quotes the value (presumably to prevent SQL injection?).

In other query filters, the filter conditions take a sea_orm::Value directly, which seems to do the correct thing (I didn't look that deeply at it, but eq works, for example). However, anything based on LIKE style queries (starts with, etc) take String inputs. If pulling the string from a sea_orm::Value::to_string call, you'll end up with a double-quoted string:

SELECT ... FROM ... WHERE "table"."column" LIKE "'cheese%'"

Which then fails to actually match anything.

  • Dependencies:
    N/A
  • Dependents:
    N/A

New Features

N/A

Bug Fixes

  • fixes LIKE and NOT LIKE queries when using string inputs.

Breaking Changes

N/A

Changes

N/A

@karatakis
Copy link
Collaborator

Fantastic work, @jsievenpiper, thanks for showing interest in the project and improving it.

@karatakis
Copy link
Collaborator

@jsievenpiper regarding the broken tests I am trying to deal with it at #161

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