createProcedure and MySQL

I haven’t run this yet because I’m a little leery of it.  :slight_smile:

A standard MySQL idiom when defining stored procedures is to set the delimiter to something like | (pipe character), so that semicolons inside the body of the statement are not interpreted by MySQL as the end of the procedure definition.

I see that is really just a refactoring with some defaults, but it doesn’t appear to have any ability to set the delimiter at the end.

For MySQL, am I best off, then, using with splitStatements set to false and endDelimiter set to, say, the pipe character?


The reason we have the setup we do is because a JDBC query is parsed differently than an interactive mysql connection.  With jdbc, it just takes a statement and executes it, assuming it is all a single statement.  It does not try to parse it based on ;'s or any other delimiters.

To support multiple statements per SQL text, we need to split them ourselves.  If you say splitStatements=false, we will not attempt any splitting, if you say splitStatements=true you can specify the end delimiter regexp that we split on. 

Normally for stored procedures, it is best to just do one procedure per sqlFile  or block.  If you want multiple statements and you can’t use the ; for a delimiter, use splitSTatements=true and endDelimiter="|" or something else you can split on.