From: Matt S Trout Date: Sat, 20 May 2006 00:34:58 +0000 (+0000) Subject: Merge 'trunk' into 'DBIx-Class-current' X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7856c0d855f4b9257f14e16b6ff4861e960bb1db;p=dbsrgits%2FDBIx-Class-Historic.git Merge 'trunk' into 'DBIx-Class-current' r8698@cain (orig r1666): tomk | 2006-05-18 15:56:54 +0000 Moved UUIDColumns.pm over from main DBIx::Class dist r8699@cain (orig r1667): tomk | 2006-05-18 15:59:52 +0000 Moved UUIDMaker.pm over from main DBIx::Class dist r8707@cain (orig r1675): tomk | 2006-05-18 16:49:41 +0000 Undoing changes commited in revisions 1664-1671... Sorry for the fuck up r8718@cain (orig r1681): jguenther | 2006-05-18 18:32:06 +0000 added bind information to exception thrown from DBIx::Class::Storage::DBI::_execute() r8731@cain (orig r1684): jguenther | 2006-05-18 21:55:45 +0000 removed another couple extraneous $self->dbh calls r8732@cain (orig r1685): jguenther | 2006-05-18 22:11:20 +0000 fixed small error in the SYNOPSIS of ResultSetManager.pm r8733@cain (orig r1686): jguenther | 2006-05-18 22:34:31 +0000 fixed an out-of-date limitation for has_many prefetch mentioned in Cookbook.pm r8741@cain (orig r1694): castaway | 2006-05-19 12:42:20 +0000 Update VERSION r8742@cain (orig r1695): castaway | 2006-05-19 13:03:20 +0000 Oops, fix bookmark thingy here too r8743@cain (orig r1696): castaway | 2006-05-19 13:12:22 +0000 .. And correct the number of tests --- 7856c0d855f4b9257f14e16b6ff4861e960bb1db diff --cc lib/DBIx/Class/Storage/DBI.pm index 3f3f49c,fd5e968..83753ac --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@@ -509,19 -446,19 +509,19 @@@ Issues a commit against the current dbh sub txn_commit { my $self = shift; + my $dbh = $self->dbh; if ($self->{transaction_depth} == 0) { - my $dbh = $self->dbh; unless ($dbh->{AutoCommit}) { - $self->debugfh->print("COMMIT\n") + $self->debugobj->txn_commit() if ($self->debug); $dbh->commit; } } else { if (--$self->{transaction_depth} == 0) { - $self->debugfh->print("COMMIT\n") + $self->debugobj->txn_commit() if ($self->debug); - $self->dbh->commit; + $dbh->commit; } } } @@@ -538,19 -475,19 +538,19 @@@ sub txn_rollback my $self = shift; eval { + my $dbh = $self->dbh; if ($self->{transaction_depth} == 0) { - my $dbh = $self->dbh; unless ($dbh->{AutoCommit}) { - $self->debugfh->print("ROLLBACK\n") + $self->debugobj->txn_rollback() if ($self->debug); $dbh->rollback; } } else { if (--$self->{transaction_depth} == 0) { - $self->debugfh->print("ROLLBACK\n") + $self->debugobj->txn_rollback() if ($self->debug); - $self->dbh->rollback; + $dbh->rollback; } else { die DBIx::Class::Storage::NESTED_ROLLBACK_EXCEPTION->new; @@@ -578,24 -517,19 +578,25 @@@ sub _execute my $sth = eval { $self->sth($sql,$op) }; if (!$sth || $@) { - $self->throw_exception('no sth generated via sql (' . ($@ || $self->_dbh->errstr) . "): $sql"); + $self->throw_exception( + 'no sth generated via sql (' . ($@ || $self->_dbh->errstr) . "): $sql" + ); } - @bind = map { ref $_ ? ''.$_ : $_ } @bind; # stringify args - my $rv = eval { $sth->execute(@bind) }; - if ($@ || !$rv) { - my $bind_str = join(', ', map { - defined $_ ? qq{`$_'} : q{`NULL'} - } @bind); - $self->throw_exception( - "Error executing '$sql' ($bind_str): ".($@ || $sth->errstr) - ); + my $rv; + if ($sth) { + my $time = time(); + $rv = eval { $sth->execute(@bind) }; + + if ($@ || !$rv) { + $self->throw_exception("Error executing '$sql': ".($@ || $sth->errstr)); + } + } else { + $self->throw_exception("'$sql' did not generate a statement."); + } + if ($self->debug) { + my @debug_bind = map { defined $_ ? qq{`$_'} : q{`NULL'} } @bind; + $self->debugobj->query_end($sql, @debug_bind); } return (wantarray ? ($rv, $sth, @bind) : $rv); } diff --cc t/helperrels/26sqlt.t index af87625,521e57d..16f7013 --- a/t/helperrels/26sqlt.t +++ b/t/helperrels/26sqlt.t @@@ -6,11 -6,9 +6,11 @@@ use DBICTest::HelperRels eval "use SQL::Translator"; plan skip_all => 'SQL::Translator required' if $@; +# do not taunt happy dave ball + my $schema = DBICTest::Schema; - plan tests => 33; -plan tests => 29; ++plan tests => 35; my $translator = SQL::Translator->new( parser_args => { @@@ -78,25 -76,13 +78,29 @@@ my @fk_constraints {'display' => 'tags -> cd', 'selftable' => 'tags', 'foreigntable' => 'cd', 'selfcols' => ['cd'], 'foreigncols' => ['cdid'], + 'needed' => 1, on_delete => 'CASCADE', on_update => 'CASCADE'}, + {'display' => 'bookmark -> link', + 'selftable' => 'bookmark', 'foreigntable' => 'link', + 'selfcols' => ['link'], 'foreigncols' => ['id'], 'needed' => 1, on_delete => '', on_update => ''}, + {'display' => 'bookmark -> link', + 'selftable' => 'bookmark', 'foreigntable' => 'link', + 'selfcols' => ['link'], 'foreigncols' => ['id'], + 'needed' => 1, on_delete => '', on_update => ''}, ); +my @unique_constraints = ( + {'display' => 'cd artist and title unique', + 'table' => 'cd', 'cols' => ['artist', 'title'], + 'needed' => 1}, + {'display' => 'twokeytreelike name unique', + 'table' => 'twokeytreelike', 'cols' => ['name'], + 'needed' => 1}, +# {'display' => 'employee position and group_id unique', +# 'table' => 'employee', cols => ['position', 'group_id'], +# 'needed' => 1}, +); + my $tschema = $translator->schema(); for my $table ($tschema->get_tables) { my $table_name = $table->name;