Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
1.1.8
-
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 "$"...