Add is_transaction_active() to all connectors (#550)

* Document the connector API method is_transaction_active()
* Move mysql::connection_base::is_transaction_active() to the other transaction-handling methods.
* Add more tests for mysql::connection::is_transaction_active()
* Add postgresql::connection_base::is_transaction_active()
* Add tests for postgresql::connection_base::is_transaction_active()
* Change the type of the SQLite3 transaction status from transaction_status_type to a boolean flag.
* Add sqlite3::connection_base::is_transaction_active()
* Add tests for sqlite3::connection_base::is_transaction_active()
* When closing a transaction do it in the following order: report (if any), execute SQL command, set transaction active flag to false.
This commit is contained in:
MeanSquaredError
2024-01-05 09:59:42 +02:00
committed by GitHub
parent 3474a4fa5d
commit 9b49afa306
7 changed files with 42 additions and 30 deletions

View File

@@ -55,6 +55,7 @@ int MoveConstructor(int, char*[])
gamma bool DEFAULT NULL
))");
assert(connections.at(0).is_transaction_active() == false);
connections.at(0).start_transaction();
auto db = std::move(connections.at(0));
assert(db.is_transaction_active());
@@ -74,6 +75,7 @@ int MoveConstructor(int, char*[])
std::cerr << "row.alpha: " << row.alpha << ", row.beta: " << row.at("beta") << std::endl;
};
db.commit_transaction();
assert(db.is_transaction_active() == false);
}
catch (const std::exception& e)
{