setAutoCommit currently calls commit() when autocommit is set to true and calls startTransaction() otherwise. This contradicts the new code (introduced in bd06526) in Data::Session:
void Session::begin() { if (isAutocommit()) { setFeature("autoCommit", false); _wasAutoCommit = true; } return _pImpl->begin(); }
For the PostgreSQL backend, setFeature("autoCommit", false) calls setAutoCommit(false) which in turn calls startTransaction(). Hence a transaction is already underway when Session()::begin() calls _pImpl->begin(), which raises an exception.
Since starting a transaction in Poco::Data::Session now changes the autocommit mode , setting the autocommit mode should not in turn start a transaction. The PostgreSQL test program also needs to be changed. It asserts that a transaction is under way after setting the autocommit mode to false:
_pSession->setFeature("autoCommit", false); assertTrue (_pSession->isTransaction());
setAutoCommit currently calls commit() when autocommit is set to true and calls startTransaction() otherwise. This contradicts the new code (introduced in bd06526) in Data::Session:
void Session::begin() { if (isAutocommit()) { setFeature("autoCommit", false); _wasAutoCommit = true; } return _pImpl->begin(); }For the PostgreSQL backend, setFeature("autoCommit", false) calls setAutoCommit(false) which in turn calls startTransaction(). Hence a transaction is already underway when Session()::begin() calls _pImpl->begin(), which raises an exception.
Since starting a transaction in Poco::Data::Session now changes the autocommit mode , setting the autocommit mode should not in turn start a transaction. The PostgreSQL test program also needs to be changed. It asserts that a transaction is under way after setting the autocommit mode to false:
_pSession->setFeature("autoCommit", false); assertTrue (_pSession->isTransaction());