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

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.1.8
    • 1.4.0
    • Other
    • 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

            georg Georg Richter
            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.