You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Angus Lees <gu...@switchonline.com.au> on 2001/12/18 04:44:44 UTC
DBIx::Recordset->Begin (patch)
apparently Begin() doesn't actually do anything..
This version calls dbh->begin_work, which temporarily turns off
AutoCommit (until the next rollback/commit) and begins a transaction.
If AutoCommit is off, you are already in a transaction and this version
still does nothing. Perhaps Begin() could give an error if its called
and the object is Dirty or something?
Apparently !DBIAttr is ignored if you're using a pre-existing !DataSource,
so this was the only way for me to get a transaction (required for
postgres large objects - else they fail in really obscure ways..)
--- /usr/share/perl5/DBIx/Recordset.pm Tue Dec 11 16:12:03 2001
+++ Recordset.pm Mon Dec 17 11:03:51 2001
@@ -727,8 +727,8 @@
{
my ($self) = @_ ;
- # 'begin' method is unhandled by DBI
- ## ?? $self->{'*DBHdl'} -> func('begin') unless $self->{'*DBHdl'}->{'AutoC
ommit'};
+ # temporarily turns AutoCommit off
+ $self->{'*DBHdl'} -> begin_work if $self->{'*DBHdl'}->{'AutoCommit'};
}
## ----------------------------------------------------------------------------
--
- Gus
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: DBIx::Recordset->Begin (patch)
Posted by Gerald Richter <ri...@ecos.de>.
> apparently Begin() doesn't actually do anything..
>
Yes, because DBI didn't had a begin method...
> This version calls dbh->begin_work, which temporarily turns off
> AutoCommit (until the next rollback/commit) and begins a transaction.
>
This make sense, unfortunately begin_work is very new (DBI 1.19 or 1.20), at
least it is newer than the last DBIx::Recordset release. This actually
explains why it isn't already in :-)
> If AutoCommit is off, you are already in a transaction and this version
> still does nothing. Perhaps Begin() could give an error if its called
> and the object is Dirty or something?
>
Should be possible. I keep it in mind for the next release.
> Apparently !DBIAttr is ignored if you're using a pre-existing !DataSource,
> so this was the only way for me to get a transaction (required for
> postgres large objects - else they fail in really obscure ways..)
>
Yes it is ignored, because DBI doesn't have a way to iterate thru all
attributes, so you don't have the possibility to retrive the !DBIAttr from a
DBI database handle.
Thanks for the patch, will be in the next release
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org