Example:
// assume PDO instance here: $dbh
function beginTransaction() {
global $dbh;
$dbh->beginTransaction();
}
beginTransaction(); // no typo! called the function above!
$dbh->exec($sql1); // assume $sql1 is there
$dbh->exec($sql2); // assume $sql2 is there
$dbh->commit();
What I try to ask: Must a transaction be started and commited inside ONE scope, or can I span a transaction over a wide range of function and method calls? For me it would be logical that the called object doesn't care about the caller. But in Objective-C / Cocoa for example, a UIView animation block IS scope-aware! So I'm confused like a bird in a plane.