[concordance] org.h2.jdbc.JdbcSQLException on values containing single quotes [message #1068479] |
Sat, 13 July 2013 12:01 |
Bo AR Messages: 3 Registered: November 2012 |
Junior Member |
|
|
Hello,
I systematically raise the following exception :
org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement INSERT INTO CROSSREFERENCES(SOURCEMODEL,TARGETMODEL,SOURCEFRAGMENT,TARGETFRAGMENT,SOURCELABEL,TARGETLABEL,LABEL) VALUES(...)
when one of values contains a single quote character.
H2 requires to double a single quote to escape it.
So as a quick fix, I solved this issue by modifying in class "org.eclipse.epsilon.concordance.db.common.H2Table", method "public void insertRow(H2Value... values) throws H2DatabaseAccessException", line :
old : valuesSql += "'" + value.value + "'";
new : valuesSql += "'" + value.value.toString().replaceAll("'", "''") + "'";
Hope this will help...
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02685 seconds