Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Incomplete
-
2.7.6, 3.1.0
-
None
-
None
Description
When connector runs a prepared statement which contains backslash in where clause parameter.
e.g.
EntityManager em = EntityManagerUtil.getEntityManager(persistenceUnit);
|
String name = "Test\\name"; |
String sql = "select * from test_table t where HEX(LCASE(t.name)) LIKE HEX(LCASE(:name))"; |
Query query = em.createNativeQuery(sql, TestTable.class); |
query.setParameter("name", name); |
List<TestTable> objects = (List<TestTable>) query.getResultList();
|
It works fine for sometime till noBackslashEscapes flag is false in connector protocol. But then noBackslashEscapes flag implicitly changed to true and connector stopped escaping backslash character in query. When query is executed on server it takes the backslash character as escape character and doesn't return the expected result.
Note: The NO_BACKSLASH_ESCAPES mode is disabled on MariaDB server.