| 641 | } |
| 642 | |
| 643 | void Connection::deleteTransaction(thread_db* tdbb, Transaction* tran) |
| 644 | { |
| 645 | // Close all active statements in tran context avoiding commit of already |
| 646 | // deleted transaction |
| 647 | Statement** stmt_ptr = m_statements.begin(); |
| 648 | |
| 649 | while (stmt_ptr < m_statements.end()) |
| 650 | { |
| 651 | Statement* stmt = *stmt_ptr; |
| 652 | if (stmt->getTransaction() == tran) |
| 653 | { |
| 654 | if (stmt->isActive()) |
| 655 | stmt->close(tdbb, true); |
| 656 | } |
| 657 | |
| 658 | // close() above could destroy statement and remove it from m_statements |
| 659 | if (stmt_ptr < m_statements.end() && *stmt_ptr == stmt) |
| 660 | stmt_ptr++; |
| 661 | } |
| 662 | |
| 663 | FB_SIZE_T pos; |
| 664 | if (m_transactions.find(tran, pos)) |
| 665 | { |
| 666 | m_transactions.remove(pos); |
| 667 | delete tran; |
| 668 | } |
| 669 | else { |
| 670 | fb_assert(false); |
| 671 | } |
| 672 | |
| 673 | if (!m_used_stmts && m_transactions.getCount() == 0 && !m_deleting) |
| 674 | m_provider.releaseConnection(tdbb, *this); |
| 675 | } |
| 676 | |
| 677 | Statement* Connection::createStatement(const string& sql) |
| 678 | { |
no test coverage detected