Fix 984915: DSNParser does not check return value of do() calls

This commit is contained in:
Brian Fraser
2012-07-12 22:42:54 -03:00
25 changed files with 1303 additions and 1039 deletions

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 35;
use Test::More tests => 37;
use DSNParser;
use OptionParser;
@@ -542,6 +542,30 @@ foreach my $password_comma ( @password_commas ) {
test_password_comma_with_auto(@$password_comma);
}
# #############################################################################
# Bug 984915: SQL calls after creating the dbh aren't checked
# #############################################################################
$dsn = $dp->parse('h=127.1,P=12345,u=msandbox,p=msandbox');
my @opts = $dp->get_cxn_params($dsn);
$opts[0] .= ";charset=garbage_eh";
my ($out, undef) = full_output(sub { $dp->get_dbh(@opts, {}) });
like(
$out,
qr/\QUnknown character set/,
"get_dbh dies withg an unknown charset"
);
$dp->prop('set-vars', "time_zoen='UTC'");
($out, undef) = full_output(sub { $dp->get_dbh($dp->get_cxn_params($dsn), {}) });
like(
$out,
qr/\QUnknown system variable 'time_zoen'/,
"get_dbh dies withg an unknown charset"
);
# #############################################################################
# Done.
# #############################################################################