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

invalid callable syntax when function name is quoted with backticks

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.8
    • Fix Version/s: 1.4.0
    • Component/s: Other
    • Labels:
      None

      Description

      Create the following function:

      CREATE FUNCTION f_one ()
        RETURNS INT
      BEGIN
        RETURN 1;
      END

      It's perfectly valid to use backticks to quote the function name in SQL:

      select `f_one`()

      But via a JDBC CallableStatement, this doesn't work. I'm getting

      Caused by: java.sql.SQLSyntaxErrorException: invalid callable syntax
          at org.mariadb.jdbc.MySQLCallableStatement.<init>(MySQLCallableStatement.java:377)
          at org.mariadb.jdbc.MySQLConnection.prepareCall(MySQLConnection.java:181)

      This is due to a wrong regular expression:

          static Pattern CALLABLE_STATEMENT_PATTERN =
                  Pattern.compile("^\\s*\\{?\\s*(\\?\\s*=)?\\s*call\\s*([\\w.]+)(\\(.*\\))?\\s*}?", Pattern.CASE_INSENSITIVE);

      Note, the regex has other issues as well, as the trailing "?", which should probably be a "$"...

        Attachments

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            lukas.eder Lukas Eder
            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.