Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1028

Connector implicitly switching noBackslashEscapes flag from false to true in protocol

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Incomplete
    • 2.7.6, 3.1.0
    • N/A
    • 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.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            Cloud-Ops@cadent.tv Cloud Ops
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.