[CONJ-605] Newlines break calling stored procedures Created: 2018-05-16  Updated: 2018-05-28  Resolved: 2018-05-24

Status: Closed
Project: MariaDB Connector/J
Component/s: MySQL compatibility
Affects Version/s: 2.2.3
Fix Version/s: 2.2.5, 1.7.4

Type: Bug Priority: Major
Reporter: Björn Raupach Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

Hi there,

we switched from MySQL Connector/J to MariaDB Connector/J recently. Unfortunately we had some issues with our code calling stored procedures. It looks like MySQL Connector/J is more lenient when it comes to validating the curly braces syntax with newlines.

For example the following character sequences work with MySQL Connector/J, but brake in MariaDB Connector/J. Examples are parameters for prepareCall in CallableStatement.

"{call foo(?,\n?) }"
"{\n  call foo (?, ?)\n }"

Maybe this looks better:

{call foo(?,
          ?) }
 
{
  call foo(?,?)
}

I have no clue how strict the JDBC specifications are with these things, but considering the following queries do work with MariaDB Connector/J, it makes sense to be either lenient in all cases or in none of them.

{call foo(?,?)
}
 
{call 
foo(?,?)
}

New lines break the prepareCall in two cases:

  1. If there is a newline right after the opening curly brace
  2. If there is one or more newlines in the argument list (between the brackets).

Both are easy to fix. If it is considered worth fixing. I open a PR, referencing this ticket in Github.

By the way: kudos to the person who wrote the regex CALLABLE_STATEMENT_PATTERN. Thats one impressive regex.

edit Here is the link to the PR: https://github.com/MariaDB/mariadb-connector-j/pull/125



 Comments   
Comment by Diego Dupin [ 2018-05-16 ]

right, that's not clear in the jdbc spec, but there is no reason not permitting line break.

Comment by Björn Raupach [ 2018-05-16 ]

Generated at Thu Feb 08 03:16:59 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.