Forum Discussion
Hello, Robert,
Thanks for your response. :smileyhappy:
I'm not sending a query to the database expecting a set.
Imagine that Delphiscript is sending an SQL statement as a "Restore Database TC from Database_Snapshot" or an "insert". Assuming that in 1st case the path to the backup file to be restored is not available at that time and the 2nd "insert" is prevented by integrity constraint.
The delphiscript would only wait for the completion of the execution of the SQL statement that was sent, if execution is prevented for some reason. Should this reason not be raised as an exception?
If this is not how it works, how will I know if it has failed or not?
Thank you. :smileyvery-happy:
Well, result set was just an example. I don't know, off hand, the specifics of every SQL command that can be executed via ADO. But the principle that I mentioned is still the same: exceptions raised in the SQL will not re-raise as exceptions in your DelphiScript. So, yes, on the SQL server side, it would raise as an exception if your SQL is coded to do so. But the ADO COmmand object "handles" that exception so that it is not reraised. In order for you to determine success/failure of the SQL you'll need to either examine whatever results you DO get back (could be numeric error code, status code, etc) OR, run a subsquent query to determine the state of the database after the command to see if it completed successfully.
I could be wrong in this, but that's been my experience.
- jhonathanramos6 years agoOccasional Contributor
Hi, Robert.
I understand that you said.
But, why it works different when my syntax is incorrect? In this case the exception is raised.
- tristaanogre6 years agoEsteemed Contributor
Because in that case, it's not the SQL server that's raising the exception but your utilization of the ADO objects.
- jhonathanramos6 years agoOccasional Contributor
Hi, Robert.
What alternative would you use to solve this problem?
Do we only have "ADO" to send instructions to the database with TestComplete?
Making a subsequent query does not seem to be a good practice, because each case will require a specific subsequent query, and I will not have how to predict everything.
Does TestComplete accept the use of other connection drivers like DBExpress for example?
Thank You.