project BLF > class Persistence Layer > method EnQuote

function returns character

Description

Put single quotes around a string and make the necessary replacements inside the string.
(copy of EnQuote in business)


Parameters


icToQuoteinputcharacter


Internal usage


BLF
method persistence.UpdateParent
method Progress.ReadDataRecursive
method Progress.ReadQuery
method Progress.ReadQueryBackward


program code (program1/persistence.p)

if icToQuote = ?
then return "'?'":U.

/* ================================================================= */
/* Replace one single quote with two single quote.                   */
/* ================================================================= */
if index(icToQuote,chr(39)) = 0
then vcWorkString = icToQuote.
else vcWorkString = replace(icToQuote,chr(39),chr(39) + chr(39)).

/* ================================================================= */
/* Replace one tilde with two tilde.                                 */
/* ================================================================= */
if index(icToQuote,chr(126)) > 0
then vcWorkString = replace(vcWorkString,chr(126),chr(126) + chr(126)).

/* ================================================================= */
/* Replace backslash with tilde + backslash. (unix only)             */
/* ================================================================= */
if opsys = "UNIX":U
then if index(icToQuote,chr(92)) > 0
     then vcWorkString = replace(vcWorkString,chr(92),chr(126) + chr(92)).

return chr(39) + vcWorkString + chr(39).