fix for issue #3440: problem with SQL queries in db_transactions after some db_multirows
the was a problem with with db_handle management in complex setups, where a db_multirow iterating over more than one tuple causes some other queries in the transaction to fail. See as well the new test case added to the regression test.
Many thanks to Keith Paskett for reporting and the good test case!