How to validate and insert the data to DB table using virtual asset
We are looking to create Parasoft API to insert the data to the tables by passing the parameters. UI should be able to invoke the API
/insertMeterNum
Step 1 to check if the data for example ( meter number ) is already exists in the table and respond back with " Meter number is already exists "
Step 2 to Insert the data in to the table if sending data ( meter number is not available in the table )
And,
/UpdateMeterNum
To update the new sending data to the existing specific meter number
Could you please help on the above request.
Answers
-
Hi,
For the first step perhaps a Database Datasource and a data source correlation could be used to have the first responder return the "already exists" message. Then if that correlation fails a second responder could be configured with a Database Tool to perform the insertion.
Here is a link to some documentation on setting up correlations
https://docs.parasoft.com/display/SVC20231/Customizing+Request+Matching+and+CorrelationsHope this helps.
0 -
Hello,
Thanks for the steps.
Just wanted to know is there anyway to achieve the requirement using scripting using extension tool?
0 -
Hi,
It's possible, but making the database connection in the scripts would be more work than using the existing Database Data Source and Database Tool which manage all that for you. It would also probably be a bit more work to do the check for the existing in a script. I would recommend trying to use the builtin tools first.
0 -
Ok, thanks for your inputs, will give it a try.
0