My original query in the DB is: select person_id from users where email = 'markq@test.com' and it runs successfully in karate as such.
The issue is when I try to replace the email with a dynamic variable from a previous response.
- def query = DB.readRow("select person_id from users where email = " + randomEmail)
- def dbResult = DB.readRow(query)
It needs single quotes, like ("select person_id from users where email = " + 'randomEmail') but Karate gives me a Bad SQL grammar error when I try that.
I have tried and failed with: '(randomEmail)' ''
I also tried the replace method, but no love there either.
Also, can someone point me to a good example of converting the SQL response into a string so its printable?