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 12:01 Go to next message
Bo AR is currently offline Bo ARFriend
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 13:09 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1475
Registered: July 2009
Location: York, UK
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 16:47 Go to previous message
Bo AR is currently offline Bo ARFriend
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: Sun Oct 22 03:11:23 GMT 2017

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

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