1


私は、liquibase と hsqldb データベースを使用しています。
ブートストラップでデータベースに入力するための「挿入」命令を含む .sql ファイルがありますが、文字列に 2 つのマイナス記号が近接して含まれている場合、文字列ではなくコメントとして解釈されます。
ここで、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 ファイル内の文字列で「--」をエスケープするにはどうすればよいですか?

4

1 に答える 1