How to include single quotes in Inno Setup while passing to function?

為{幸葍}努か 提交于 2019-12-22 10:45:30

问题


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



来源:https://stackoverflow.com/questions/32604083/how-to-include-single-quotes-in-inno-setup-while-passing-to-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!