X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage.pm;h=dd61ba0deec4c3ae51f93a83d4bf441347444ba3;hp=f590b36bc26164999bac8170a67f5989e40b8795;hb=b9b4e52f923e01eb496eb04a70e82824ecbe9dbe;hpb=e4eb8ee1d77be917d2d721695e203c941e0219a2 diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index f590b36..dd61ba0 100644 --- a/lib/DBIx/Class/Storage.pm +++ b/lib/DBIx/Class/Storage.pm @@ -8,6 +8,7 @@ use base qw/DBIx::Class/; use Scalar::Util qw/weaken/; use Carp::Clan qw/^DBIx::Class/; use IO::File; +use DBIx::Class::Storage::TxnScopeGuard; __PACKAGE__->mk_group_accessors('simple' => qw/debug debugobj schema/); __PACKAGE__->mk_group_accessors('inherited' => 'cursor_class'); @@ -61,20 +62,11 @@ sub new { $new->set_schema($schema); $new->debugobj(new DBIx::Class::Storage::Statistics()); - my $fh; + #my $fh; my $debug_env = $ENV{DBIX_CLASS_STORAGE_DBI_DEBUG} || $ENV{DBIC_TRACE}; - if (defined($debug_env) && ($debug_env =~ /=(.+)$/)) { - $fh = IO::File->new($1, 'w') - or $new->throw_exception("Cannot open trace file $1"); - } else { - $fh = IO::File->new('>&STDERR'); - } - - $fh->autoflush(1); - $new->debugfh($fh); $new->debug(1) if $debug_env; $new; @@ -270,6 +262,53 @@ which allows the rollback to propagate to the outermost transaction. sub txn_rollback { die "Virtual method!" } +=head2 svp_begin + +Arguments: $savepoint_name? + +Created a new savepoint using the name provided as argument. If no name +is provided, a random name will be used. + +=cut + +sub svp_begin { die "Virtual method!" } + +=head2 svp_release + +Arguments: $savepoint_name? + +Release the savepoint provided as argument. If none is provided, +release the savepoint created most recently. This will implicitly +release all savepoints created after the one explicitly released as well. + +=cut + +sub svp_release { die "Virtual method!" } + +=head2 svp_rollback + +Arguments: $savepoint_name? + +Rollback to the savepoint provided as argument. If none is provided, +rollback to the savepoint created most recently. This will implicitly +release all savepoints created after the savepoint we rollback to. + +=cut + +sub svp_rollback { die "Virtual method!" } + +=for comment + +=head2 txn_scope_guard + +Return an object that does stuff. + +=cut + +sub txn_scope_guard { + return DBIx::Class::Storage::TxnScopeGuard->new($_[0]); +} + =head2 sql_maker Returns a C object - normally an object of class @@ -428,6 +467,11 @@ re-connect on your schema. Old name for DBIC_TRACE +=head1 SEE ALSO + +L - reference storage implementation using +SQL::Abstract and DBI. + =head1 AUTHORS Matt S. Trout