ALL,

Consider following pseudo code:

std::vector<std::string> queries; queries.push_back( "CREATE TABLE X1();" ); queries.push_back( "CREATE TABLE X2();" ); queries.push_back( "CREATE TABLE X3();" ); queries.push_back( "INSERT INTO X! VALUES();" ); queries.push_back( "INSERT INTO X1 VALUES();" ); queries.push_back( "INSERT INTO X2 VALUES();" ); queries.push_back( "INSERT INTO X2 VALUES();" ); queries.push_back( "INSERT INTO X3 VALUES();" ); queries.push_back( "INSERT INTO X3 VALUES();" ); for( std::vector<std::string>::iterator it = queries.begin(); it < queries.end(); ++ it ) { res = execute( (*it) ); if( failure ) break; }

If for whatever reason the very first command failed then everything is good.

However if the second or third command fails - I'd like to drop all previously created tables,, investigate and then start over as it does not make much sense to continue due to the logic of the program.

As far as I know only SQLite supports transactional DDL..

So how do people handle situations like this?

TIA!!

The above snippet is a pseudo-code as it is DBMS-agnostic and the question is very generic..

Igor's user avatar

7

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.