As part of our API project at work, I am looking to incorporate database calls into our end-to-end process. One challenge I am facing is how to handle single quotes within a variable that is passed as an argument in an assert method. I have attempted the following methods without success.
assert JavaClass.executeSQLQuery('SELECT COUNT(*) As Result FROM PartType WHERE reference = 'evaluate';', '1') == true
The issue lies in properly escaping the single quotes within the value
Here are some other approaches I have tried:
def sqlQuery =
"""
SELECT COUNT(*) As Result
FROM PartType
WHERE reference = 'updateerferencee';
"""
assert JavaMethods.executeSQLQuery(sqlQuery, '1') == true
ERROR: Check out the attached image for detailshttps://i.sstatic.net/uyUM1.png