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

Escape character in LIKE expressions is not escaped by querydsl #438

Closed
LordOfTheHelmet opened this Issue Jun 11, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@LordOfTheHelmet

To reproduce this:

BooleanExpression patternPredicate = company.name.toLowerCase().like("%My! Text%");

When i execute this i get the exception:

java.sql.SQLDataException: ORA-01424: Zeichen nach dem Escape-Zeichen fehlen oder sind ungültig

The SQL generated from the expression looks like:

lower(company0_.NAME) like ? escape '!'

and the bound value is:

TRACE org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:84) - binding parameter [1] as [VARCHAR] - %My! Text%

Shouldn't querydsl escape the escape character for me? Otherwise i have to do something like:

BooleanExpression patternPredicate = company.name.toLowerCase().like("%My! Text%".replaceAll("!", "!!"), '!');
@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Jun 11, 2013

Member

That would also mean that actual escaping is only available when the other like variants are used.

str.like("\\%")

would need to be written as

str.like("\\%", '\\')

But maybe this makes sense, since it makes escaping more explicit.

Member

timowest commented Jun 11, 2013

That would also mean that actual escaping is only available when the other like variants are used.

str.like("\\%")

would need to be written as

str.like("\\%", '\\')

But maybe this makes sense, since it makes escaping more explicit.

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Jun 26, 2013

Member

Released in 3.2.1

Member

timowest commented Jun 26, 2013

Released in 3.2.1

@timowest timowest closed this Jun 26, 2013

@LordOfTheHelmet

This comment has been minimized.

Show comment
Hide comment
@LordOfTheHelmet

LordOfTheHelmet Jun 27, 2013

Thanks for accepting and implementing it!

Thanks for accepting and implementing it!

@timowest timowest added this to the 3.2.1 milestone Apr 14, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment