On 10-Mar-2005 Jonathan Leffler wrote:
> On Wed, 09 Mar 2005 08:55:21 -0000 (GMT), Martin J. Evans
> <[EMAIL PROTECTED]> wrote:
>> Just a small point.
>>
>> I could be wrong (I cannot look it up right now) but I think in ODBC
>> SQLEndTran
>> can issue a rollback or commit on ALL connections. Effectively, it issues
>> the
>> rollback/commit on each connection in the environment.
>> That would be a lot harder to do with $dbh->do since you'd have to do it
>> once
>> per connection.
>
> That would have to be issued on a driver handle, wouldn't it? And the
> driver would have to know about all its children...
>
> $dbh->{Driver}->rollback_all
> $dbh->{Driver}->commit_all
I think so. DBD::ODBC only allocates one environment (as recommened in ODBC) but
then multiple connection handles as they are requested under that environment. A
call to:
SQLEndTran(environment handle, SQL_COMMIT)
is sort of a short hand for:
SQLEndTran(connection handle1, SQL_COMMIT)
SQLEndTran(connection handle2, SQL_COMMIT)
although ODBC does not define what happens if one of the commits on a
connection fails (this alone probably makes commiting on an environment
unpopular if used at all). With DBI, you do $dbh->commit which is equivalent to
SQLEndTran(connection handle) and DBI does not know about the ODBC environment
handle so you'd have to do (presently):
$dbh1->commit
$dbh2->commit
I don't think there is any big point here, I was just following the discussion
and was pointing out there is something you can do with ODBC in a single
call that you cannot mimic with SQL.
Martin
--
Martin J. Evans
Easysoft Ltd, UK
Development