I have a DataImportHandler for importing data from a SQL database. The root entity, Foo has many Bars. The Bar table uses Foo.Name as its foreign key. Some Foo names have single quotes in them–such as STW's.
The import query for the Bar entity is something like:
select name from Bar where Foo_Name = ${Foo.Name}
However, when Foo.Name contains a single quote the import fails with a SQL exception of Incorrect syntax near 's.
I’ve tried wrapping the parameter with escapeSql(${Foo.Name}) but it doesn’t appear to be called–the sql being executed is where Foo_Name = 'escapeSql(STW's)'
How do I properly escape the Foo.Name to avoid issues when they contain single-quotes?
I think the correct syntax is:
since
escapeSqlis a solr function and not a normal sql function.