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

SQL Anywhere: invalid escape character on like expression #2798

Closed
monaheinz opened this issue Aug 22, 2022 · 1 comment
Closed

SQL Anywhere: invalid escape character on like expression #2798

monaheinz opened this issue Aug 22, 2022 · 1 comment
Assignees
Labels
Milestone

Comments

@monaheinz
Copy link

Expected behavior

I want to use the like expression with a sql anywhere database.

Actual behavior

javax.persistence.PersistenceException: Query threw SQLException:[Sybase][JDBC Driver][SQL Anywhere]Invalid escape character ''

  Expression e = Expr.like("column1" "div%");
  query().where().add(e).findList();
  javax.persistence.PersistenceException: Query threw SQLException:[Sybase][JDBC Driver][SQL Anywhere]Invalid escape character ''

The Expression results in the following SQL where statement:

where t0.column1like ? escape'' 

For default behavior escape should be set to ~ or left empty in SqlAnywherePlatform

protected String likeClauseRaw = "like ? escape'~'";
@rbygrave rbygrave self-assigned this Aug 23, 2022
@rbygrave rbygrave added this to the 13.8.1 milestone Aug 23, 2022
@rbygrave rbygrave added the bug label Aug 23, 2022
@rbygrave
Copy link
Member

Thanks. Gone with the ansi default option of no escape clause (as opposed to escape with ''). Added a test to show the platform differences.

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

No branches or pull requests

2 participants