~percona-toolkit-dev/percona-toolkit/pt-query-advisor-docs-2

« back to all changes in this revision

Viewing changes to lib/DSNParser.pm

Merge fix-password-comma-bug-886077.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
$Data::Dumper::Indent    = 0;
33
33
$Data::Dumper::Quotekeys = 0;
34
34
 
 
35
# Passwords may contain commas.
 
36
# https://bugs.launchpad.net/percona-toolkit/+bug/886077
 
37
my $dsn_sep = qr/(?<!\\),/;
 
38
 
35
39
eval {
36
40
   require DBI;
37
41
};
126
130
   my $opts = $self->{opts};
127
131
 
128
132
   # Parse given props
129
 
   foreach my $dsn_part ( split(/,/, $dsn) ) {
 
133
   foreach my $dsn_part ( split($dsn_sep, $dsn) ) {
 
134
      $dsn_part =~ s/\\,/,/g;
130
135
      if ( my ($prop_key, $prop_val) = $dsn_part =~  m/^(.)=(.*)$/ ) {
131
136
         # Handle the typical DSN parts like h=host, P=3306, etc.
132
137
         $given_props{$prop_key} = $prop_val;