X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage.pm;h=91fe228f7781c3ea725a3fec1c4700dab404ce17;hb=96eab6f8adc4e23f4212aa6b6bf681137aa5f654;hp=735ac65ff1c4023f55739ccab55750e9cb11a618;hpb=942cd0c142a828426a2ba3650991188c7c02178c;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index 735ac65..91fe228 100644 --- a/lib/DBIx/Class/Storage.pm +++ b/lib/DBIx/Class/Storage.pm @@ -8,8 +8,14 @@ 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'); + +__PACKAGE__->cursor_class('DBIx::Class::Cursor'); + +sub cursor { shift->cursor_class(@_); } package # Hide from PAUSE DBIx::Class::Storage::NESTED_ROLLBACK_EXCEPTION; @@ -56,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; @@ -265,6 +262,18 @@ which allows the rollback to propagate to the outermost transaction. sub txn_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 @@ -324,14 +333,12 @@ sub debugcb { } } -=head2 cursor +=head2 cursor_class The cursor class for this Storage object. =cut -sub cursor { die "Virtual method!" } - =head2 deploy Deploy the tables to storage (CREATE TABLE and friends in a SQL-based @@ -425,6 +432,10 @@ re-connect on your schema. Old name for DBIC_TRACE +=head1 SEE ALSO + +L - reference storage inplementation using SQL::Abstract and DBI. + =head1 AUTHORS Matt S. Trout