Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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
Bo AR is currently offline 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...
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
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 836
Registered: July 2009
Senior Member
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
Bo AR is currently offline Bo AR
Messages: 3
Registered: November 2012
Junior Member
See bug 412901
Previous Topic:Feasibility of having a megamodel in Epsilon
Next Topic:[ETL] same metamodel
Goto Forum:
  


Current Time: Fri Aug 22 13:54:25 EDT 2014

Powered by FUDForum. Page generated in 0.03464 seconds