Skip to content
Browse files

Revision 1.40

  • Loading branch information...
1 parent f4bc5d6 commit a9f1da81e27919419b9f7e02c99fb63fc818fccf @bluescreen10 committed Jun 22, 2011
Showing with 21 additions and 19 deletions.
  1. +8 −2 Changes
  2. +12 −17 lib/DBD/Mock.pm
  3. +1 −0 t/021_DBD_Mock_Session.t
View
10 Changes
@@ -1,11 +1,17 @@
Revision history for Perl extension DBD::Mock.
+1.40 June 19, 2011
+ - Fixed bug rt44591 second preapre giving an error
+ - Fixed bug rt57981 warnings during clone
+ - Fixed bug rt63191 Synopsis errors
+ - Fixed bug rt66813 Google's group link in the POD
+
1.39 November 9, 2008
- If a statement handle had bound columns, then the fetch() and
fetchrow_arrayref() methods never returned false. After they
exhausted their data, they kept returning empty array
- references. Fixes RT #37054.
- - Hid all packages but DBD::Mock from PAUSE.
+ references.
+ - Hid all packaged but DBD::Mock from PAUSE.
1.38 November 8, 2008
- Bumped minimum Perl to 5.8.1, since that's what DBI requires.
View
29 lib/DBD/Mock.pm
@@ -20,7 +20,7 @@ use warnings;
require DBI;
-our $VERSION = '1.39';
+our $VERSION = '1.40';
our $drh = undef; # will hold driver handle
our $err = 0; # will hold any error codes
@@ -245,18 +245,6 @@ sub prepare {
return;
}
- if (my $session = $dbh->FETCH('mock_session')) {
- eval {
- $session->verify_statement($dbh, $statement);
- };
- if ($@) {
- my $session_error = $@;
- chomp $session_error;
- $dbh->DBI::set_err(1, "Session Error: ${session_error}. Statement: ${statement}");
- return;
- }
- }
-
my $sth = DBI::_new_sth($dbh, { Statement => $statement });
$sth->trace_msg("Preparing statement '${statement}'\n", 1);
@@ -437,7 +425,9 @@ sub FETCH {
sub STORE {
my ( $dbh, $attrib, $value ) = @_;
- $dbh->trace_msg( "Storing DB attribute '$attrib' with '" . (defined($value) ? $value : 'undef') . "'\n" );
+
+ my $printed_value = $value || 'undef';
+ $dbh->trace_msg( "Storing DB attribute '$attrib' with '$printed_value'\n" );
if ($attrib eq 'AutoCommit') {
# These are magic DBI values that say we can handle AutoCommit
@@ -526,11 +516,11 @@ sub STORE {
return $dbh->{$attrib} = $value;
}
elsif ($attrib =~ /^(private_|dbi_|dbd_|[A-Z])/ ) {
- $dbh->trace_msg("... storing non-driver attribute ($attrib) with value ($value) that DBI handles\n");
+ $dbh->trace_msg("... storing non-driver attribute ($attrib) with value ($printed_value) that DBI handles\n");
return $dbh->SUPER::STORE($attrib, $value);
}
else {
- $dbh->trace_msg("... storing non-driver attribute ($attrib) with value ($value) that DBI won't handle\n");
+ $dbh->trace_msg("... storing non-driver attribute ($attrib) with value ($printed_value) that DBI won't handle\n");
return $dbh->{$attrib} = $value;
}
}
@@ -619,6 +609,7 @@ sub execute {
if (my $session = $dbh->{mock_session}) {
eval {
+ $session->verify_statement($dbh, $sth->{Statement});
$session->verify_bound_params($dbh, $tracker->bound_params());
my $idx = $session->{state_index} - 1;
my @results = @{$session->{states}->[$idx]->{results}};
@@ -2065,7 +2056,7 @@ Perl Code Kata: Testing Databases - L<http://www.perl.com/pub/a/2005/02/10/datab
We have created a B<DBD::Mock> google group for discussion/questions about this module.
-L<http://groups-beta.google.com/group/DBDMock>
+L<http://groups.google.com/group/DBDMock>
=head1 ACKNOWLEDGEMENTS
@@ -2099,6 +2090,8 @@ Copyright (C) 2004-2007 Stevan Little E<lt>stevan@iinteractive.comE<gt>
Copyright (C) 2007 Rob Kinyon E<lt>rob.kinyon@gmail.comE<gt>
+Copyright (C) 2011 Mariano Wahlmann E<lt>dichoso _at_ gmail.comE<gt>
+
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
@@ -2110,4 +2103,6 @@ Stevan Little E<lt>stevan@iinteractive.comE<gt>
Rob Kinyon E<lt>rob.kinyon@gmail.comE<gt>
+Mariano Wahlmann E<lt>dichoso _at_ gmail.com <gt>
+
=cut
View
1 t/021_DBD_Mock_Session.t
@@ -96,6 +96,7 @@ use DBI;
eval {
Login::Test::login($dbh, 'user', '****')
};
+
ok($@, '... got the exception');
like($@, qr/Session Error\: Session states exhausted/, '... got the exception we expected');

0 comments on commit a9f1da8

Please sign in to comment.
Something went wrong with that request. Please try again.