How to verify a particular user is available in the database or not?
We can achieve this in four steps:
Need a SQL file to retrieve the data from the database
Need a service suite script to run the SQL query and store it in a variable to compare
Need a CSV file that contains the user or users
Implementation in .ds script
For step-1 we have to create a SQL file in the below format:
-- dbvendor=MYSQL -- username=XXXX -- password=XXXX -- host=localhost -- schema=XXXX -- port=3306 -- connect -- limit=1-10 -- tag=executedScenarios SELECT * from DATABASENAME.TABLENAME -- storeInLocker= -- disconnect
For step-2, below are the syntax for service suite script:
processSQLFile("{ds}/sqlScript.sql");
var result = JSON.parse(locker.get("executedScenarios"));
log(result);
var xyz;
locker.put("xyz",result);
For step-3, use any CSV in below format:
For step-4, use the below step
Last updated: August 03, 2023
If you have any feedback on this topic, please contact us at documentation@appvance.ai