Tap::ok($conn1->start(), 'started a transaction on conn1'); Tap::ok($conn2->start(), 'started a transaction on conn2'); $rs = $conn1->execute("insert into {$table} values (1)"); Tap::ok($rs, 'inserted a row into test table from conn1'); //if( ! $rs ) Tap::debug( $conn1 ); $rs = $conn2->execute("insert into {$table} values(2)"); Tap::ok($rs, 'inserted a row into test table from conn2'); //if( ! $rs ) Tap::debug( $conn2 ); Tap::ok($conn1->commit(), 'committed inserted row on conn1'); Tap::ok($conn2->commit(), 'committed inserted row on conn2'); Tap::ok($rs = $dbmain->execute("select id from {$table}"), 'selected all rows from the table'); $ct = $rs->affected(); Tap::is($ct, 2, '2 rows in the table'); //var_dump( $rs ); //var_dump( $conn1 ); Transaction::reset(); Tap::ok(Transaction::start(), 'started a transaction at the global level'); $conn1 = $newconn(); $conn2 = $newconn(); Tap::ok($conn1->start(), 'started a transaction on conn1'); Tap::ok($conn2->start(), 'started a transaction on conn2'); $rs = $conn1->execute("insert into {$table} values (3)"); Tap::ok($rs, 'inserted a row into test table from conn1'); //if( ! $rs ) Tap::debug( $conn1 ); $rs = $conn2->execute("insert into {$table} values(4)"); Tap::ok($rs, 'inserted a row into test table from conn2'); //if( ! $rs ) Tap::debug( $conn2 ); Tap::ok($conn1->commit(), 'committed inserted row on conn1'); Tap::ok($conn2->commit(), 'committed inserted row on conn2'); Tap::ok(Transaction::rollback(), 'rolled back the transaction at the global level'); Tap::ok($rs = $dbmain->execute("select id from {$table}"), 'selected all rows from the table');