How to include single quotes in Inno Setup while p

2019-05-15 09:34发布

问题:

I have used string in a function as follow.

I'm passing a string to a particular function, if that string has single quotes inside middle it's breaking. How to include single quotes in Inno Setup Pascal scripting?

TempReadValue(StrArray, 'log4j.appender.testing.File=INSERT INTO emp select Eid,'%K','%L'from DistributionTable  whereEname = 'Nails:chino'', LogFileName);

When passing to function its taking till %K, after that its breaking. Can anybody guide me how to read/pass entire string till Nils:chino?

Thanks for your help.

回答1:

Try this one:

TempReadValue(StrArray, 'log4j.appender.testing.File=INSERT INTO emp select Eid,'+Chr(39)+'%K'+Chr(39)+','+Chr(39)+'%L'+Chr(39)+'from DistributionTable  whereEname = '+Chr(39)+'Nails:chino'+Chr(39), LogFileName);

This will work.



回答2:

You have to double the single quote:

TempReadValue(
  StrArray,
  'log4j.appender.testing.File=INSERT INTO emp select Eid,''%K'',''%L''from DistributionTable  whereEname = ''Nails:chino''',      
  LogFileName);

See https://www.freepascal.org/docs-html/ref/refse8.html