if ($CFG->dbtype === 'postgres7') {
$db->StartTrans();
}
It's a one-line change and doesn't seem to have broken anything. There are significant advantages to the StartTrans approach, particularly that you can nest calls - very useful in ensuring transactions either happen or (if there's an error) don't.
For example, consider a method add_frog, which needs to add rows to several tables. If it fails, it should fail 'cleanly' without leaving the frog half-added, so you put in begin_sql and commit_sql before and after. OK cool but now you want to make a new method add_frogs_nest which calls add_frog multiple times. You now want the whole nest to be either added or (if there's an error) not added. So you add begin_sql and commit_sql... but this will just mess it up, under the current situation, because you can't nest the calls. [It'll still 'work', but if it fails midway through, the nest will be left midway added.] Making begin_sql use StartTrans would allow this without any other code changes.
See the explanation here:
http://phplens.com/lens/adodb/docs-adodb.htm#ex11
Is there any reason Moodle isn't using it? For example, perhaps Moodle is using an older version of ADODB and a newer ADODB can't be installed because it requires newer PHP version, or something like that? Or some more fundamental reason why it would be a problem? Otherwise I think it would be a good change...
--sam
PS As you can guess this is another of the small changes that I would like to have in core.
PPS No I don't think frog's nest is the right word.