Show
Ignore:
Timestamp:
05/16/08 22:36:08 (19 months ago)
Author:
bchoate
Message:

Issue _set_names when init_dbh is invoked. BugId:79506

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-38/lib/MT/ObjectDriver/Driver/DBD/mysql.pm

    r1769 r2367  
    3737} 
    3838 
    39 sub configure { 
     39sub init_dbh { 
    4040    my $dbd = shift; 
    41     my ($driver) = @_; 
    42     $dbd->_set_names($driver); 
    43     $dbd; 
     41    my ($dbh) = @_; 
     42    $dbd->SUPER::init_dbh(@_); 
     43    $dbd->_set_names($dbh); 
    4444} 
    4545 
    4646sub _set_names { 
    4747    my $dbd = shift; 
    48     my ($driver) = @_; 
    49     my $dbh = $driver->rw_handle; 
     48    my ($dbh) = @_; 
     49    return 1 if exists $dbh->{private_set_names}; 
    5050 
     51warn "got here"; 
    5152    my $cfg = MT->config; 
    5253    my $set_names = $cfg->SQLSetNames; 
     54    $dbh->{private_set_names} = 1; 
    5355    return 1 if (defined $set_names) && !$set_names; 
    5456 
     
    5658        local $@; 
    5759        my $sth = $dbh->prepare('show variables like "character_set_database"') 
    58             or return $driver->error($dbh->errstr); 
    59         $sth->execute or return $driver->error($sth->errstr); 
     60            or die "error collecting variables from mysql: " . $dbh->errstr; 
     61        $sth->execute or die "error collecting variables from mysql: " . $sth->errstr; 
    6062        my $result = $sth->fetchall_hashref('Variable_name'); 
    6163        my $charset_db = $result->{character_set_database}{Value};