383879 {
383880 CurrentTransactionState chained_transaction_state = NOT_IN_ACTIVE_TRANSACTION;
383881 vector<unique_ptr<SQLStatement>> new_statements;
383882 for (
idx_t i = 0; i < statements.size(); i++) {
383883 auto query = statements[i]->query;
383884 const CurrentTransactionState full_transaction_state =
383885 (transaction_context_state == IN_ACTIVE_TRANSACTION || chained_transaction_state == IN_ACTIVE_TRANSACTION)
383886 ? IN_ACTIVE_TRANSACTION
383887 : NOT_IN_ACTIVE_TRANSACTION;
383888
383889 switch (statements[i]->type) {
383890 case StatementType::PRAGMA_STATEMENT: {
383892 const auto handling = GetTransactionHandling(reparsed_statements, full_transaction_state);
383893 AddStatements(reparsed_statements, handling, new_statements);
383894 break;
383895 }
383896 case StatementType::MULTI_STATEMENT: {
383897 auto &multi_statement = statements[i]->Cast<MultiStatement>();
383898 UnpackMultiStatement(multi_statement, full_transaction_state, new_statements);
383899 break;
383900 }
383901 case StatementType::TRANSACTION_STATEMENT: {
383902 auto &transaction_stmt = statements[i]->Cast<TransactionStatement>();
383903
383904 if (transaction_stmt.info->type == TransactionType::BEGIN_TRANSACTION) {
383905 new_statements.push_back(std::move(statements[i]));
383906 chained_transaction_state = IN_ACTIVE_TRANSACTION;
383907 break;
383908 }
383909 if (transaction_stmt.info->type == TransactionType::COMMIT ||
383910 transaction_stmt.info->type == TransactionType::ROLLBACK) {
383911 chained_transaction_state = NOT_IN_ACTIVE_TRANSACTION;
383912 }
383913 new_statements.push_back(std::move(statements[i]));
383914 break;
383915 }
383916 default: {
383917 new_statements.push_back(std::move(statements[i]));
383918 }
383919 }
383920 }
383921
383922 statements = std::move(new_statements);
383923}
vector< unique_ptr< SQLStatement > > TryReparsePragma(unique_ptr< SQLStatement > statement) const
Definition duckdb.cpp:383841
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237