Skip to main content



      Home
Home » Modeling » Epsilon » [concordance] org.h2.jdbc.JdbcSQLException on values containing single quotes
[concordance] org.h2.jdbc.JdbcSQLException on values containing single quotes [message #1068479] Sat, 13 July 2013 08:01 Go to next message
Eclipse UserFriend
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...
Re: [concordance] org.h2.jdbc.JdbcSQLException on values containing single quotes [message #1068494 is a reply to message #1068479] Sat, 13 July 2013 09:09 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Thanks for reporting this! We'll probably need to rewrite this class to use prepared statements to avoid similar issues in the future. Could you please file a bug in the bugzilla?

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=epsilon

Cheers,
Dimitris
Re: [concordance] org.h2.jdbc.JdbcSQLException on values containing single quotes [message #1068872 is a reply to message #1068494] Sun, 14 July 2013 12:47 Go to previous message
Eclipse UserFriend
See bug 412901
Previous Topic:Feasibility of having a megamodel in Epsilon
Next Topic:[ETL] same metamodel
Goto Forum:
  


Current Time: Wed Jul 23 22:06:43 EDT 2025

Powered by FUDForum. Page generated in 0.04490 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top