我正在使用 liquibase 和 hsqldb 数据库。
我有一个 .sql 文件,其中包含用于在引导程序中填充数据库的“插入”指令,但如果一个字符串包含两个彼此接近的减号,则它被解释为注释而不是字符串。
这是 liquibase 加载的 .sql 文件中的我的 sql 指令:
INSERT INTO user (id,firstname,lastname,mystring) VALUES
(11,'Wendy','Salinas','this is my string--and it continues'),
(12,'Kirsten','Parker','this is the string of Kirsten')
还有我的堆栈跟踪:
liquibase.exception.DatabaseException: Error executing SQL INSERT INTO user (id,firstname,lastname,mystring) VALUES
(11,'Wendy','Salinas','this is my string
(12,'Kirsten','Parker','this is the string of Kristen')
Caused by: java.sql.SQLSyntaxErrorException: unexpected token: KIRSTEN required: ) : line: 12
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)
at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
有没有办法为 liquibase 使用的 sql 文件转义字符串中的注释?
如何在 liquibase 使用的 .sql 文件中的字符串中转义“--”?