No! That is not a good idea. It introduces unnecessary loss of
backwards compatibility.
Another option that is backwards compatible is to instead handle
multi-line commands specially by introducing a "continuation"
symbol/operator. Think `\` on *nix. The idea being that a line ending
with '\' is considered to continue on the next line.
A more generic solution would be to introduce a contract for splitting
up import.sql files into commands. Something like:
interface ImportSqlCommandExtracter {
public String[] extractCommands(InputStreamReader streamReader);
}
We could even supply 2 impls, one for "required semicolon as separator"
and another for "continuation symbol". And allow users to develop and
supply their own for other situations.
On Sun 06 Nov 2011 06:57:12 AM CST, Ćukasz Antoniak wrote:
Welcome!
Last time I have been trying to improve the way that Hibernate extracts
statements from "import.sql" script. My intention was to support
multiline SQL instructions (HHH-2403), quoted strings, multiline
comments etc. After developing quite simple ANTLR-based parser, I have
realized that right now semicolons are not mandatory (at the end of each
SQL statement). If there is no separator character (e.g. ';') between
statements, the only possibility to resolve HHH-2403 is to apply a full
SQL parser. But supporting all different dialects would be quite
difficult... Is it acceptable to change the code, so that each statement
must be ended with a semicolon (branch 4.0)?
You can see my work here:
https://github.com/lukasz-antoniak/hibernate-core/commit/c11b881a8975502f...
Regards,
Lukasz Antoniak
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev
--
steve(a)hibernate.org
http://hibernate.org