C++ – How to check if a SQL query is valid for writing with ADO

adoc++sqlvalidation

My app has an advanced feature that accepts SQL queries written by the user. The feature should include a "Validate" button to check if the query is valid.

The most simple way I found to do this using ADO is just trying to run the query and catch possible exceptions. But how can I also check if the query enables to add new records or to edit existing ones?

Best Solution

Transactions, anyone?

begin transaction

// Query being validated goes here

rollback transaction