[CONJ-161] invalid callable syntax when function name is quoted with backticks Created: 2015-06-03 Updated: 2016-05-23 Resolved: 2016-05-23 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | Other |
| Affects Version/s: | 1.1.8 |
| Fix Version/s: | 1.4.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Lukas Eder | Assignee: | Georg Richter |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Create the following function:
It's perfectly valid to use backticks to quote the function name in SQL:
But via a JDBC CallableStatement, this doesn't work. I'm getting
This is due to a wrong regular expression:
Note, the regex has other issues as well, as the trailing "?", which should probably be a "$"... |
| Comments |
| Comment by Vladislav Vaintroub [ 2015-06-05 ] | |||||||||||||
|
The complain is about backticks, right? Or you are expecting "select" to work as in your example. i.e Connection.prepareCall("select `f_one`()") ? The documentation http://docs.oracle.com/javase/7/docs/api/java/sql/CallableStatement.html does not allow "selects", there are just 2 forms, with escape syntax, both use "call". Quotes could be allowed, the docs are not specific on what constitutes a <procedure-name> | |||||||||||||
| Comment by Lukas Eder [ 2015-06-05 ] | |||||||||||||
|
This is what I tried, which didn't work:
The JDBC spec reads: > JDBC drivers may optionally provide support for invoking user-defined or vendor defined functions using the escape syntax for stored procedures. From §13.4.4: http://download.oracle.com/otn-pub/jcp/jdbc-4_2-mrel2-spec/jdbc4.2-fr-spec.pdf A workaround is to ignore potential case-sensitivity, but I like to stay on the safe side, usually | |||||||||||||
| Comment by Vladislav Vaintroub [ 2015-06-05 ] | |||||||||||||
|
Understood. That part in spec is not about DBMS specific rules for quotes, in my understanding. It is about using functions in place of stored procedures. " | |||||||||||||
| Comment by Lukas Eder [ 2015-06-05 ] | |||||||||||||
|
Well, in any case, the current driver is specs-compliant. On the other hand, I'm not aware of any database that doesn't allow the ordinary name quoting characters also in the JDBC/ODBC escape syntax, as this is the only way to enforce case-sensitivity (in some databases) or functions / procedures with special characters in their names (in all databases). Let me give you another, more obvious example:
Without supporting backticks, how would you call this function? | |||||||||||||
| Comment by Diego Dupin [ 2016-05-23 ] | |||||||||||||
|
This has been correction in 1.4 :
|