Procedure to escape quotes in order to be used as escaped.
This is useful when passing names that have quotes and they are going to be used in prepared statements
SET LENGTH = LENGTH(MSG);
SET INDEX = 0;
SET RET = '';
WHILE (INDEX < LENGTH) DO
SET INDEX = POSSTR(MSG, '''');
IF (INDEX <> 0) THEN
SET PRE = SUBSTR(MSG, 1, INDEX - 1);
SET RET = RET || PRE || '''''';
SET MSG = SUBSTR(MSG, INDEX + 1);
SET INDEX = 0;
SET LENGTH = LENGTH(MSG);
ELSE
SET INDEX = LENGTH;
SET RET = RET || MSG;
END IF;
END WHILE;
RETURN RET;
Procedure to escape quotes in order to be used as escaped. This is useful when passing names that have quotes and they are going to be used in prepared statements
SET LENGTH = LENGTH(MSG); SET INDEX = 0; SET RET = ''; WHILE (INDEX < LENGTH) DO SET INDEX = POSSTR(MSG, ''''); IF (INDEX <> 0) THEN SET PRE = SUBSTR(MSG, 1, INDEX - 1); SET RET = RET || PRE || ''''''; SET MSG = SUBSTR(MSG, INDEX + 1); SET INDEX = 0; SET LENGTH = LENGTH(MSG); ELSE SET INDEX = LENGTH; SET RET = RET || MSG; END IF; END WHILE; RETURN RET;