Changeset 2367

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

Issue _set_names when init_dbh is invoked. BugId:79506

Location:
branches/release-38/lib/MT/ObjectDriver/Driver/DBD
Files:
2 modified

Legend:

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

    r1769 r2367  
    5252    my $dbd = shift; 
    5353    my ($driver) = @_; 
    54     $dbd->_set_names($driver); 
    5554    $driver->pk_generator(\&pk_generator);  
    56  
    5755    return $dbd; 
    5856} 
     
    8684} 
    8785 
     86sub init_dbh { 
     87    my $dbd = shift; 
     88    my ($dbh) = @_; 
     89    $dbd->SUPER::init_dbh(@_); 
     90    $dbd->_set_names($dbh); 
     91} 
     92 
    8893sub _set_names { 
    8994    my $dbd = shift; 
    90     my ($driver) = @_; 
    91     my $dbh = $driver->r_handle; 
    92     return 1 if exists $driver->{set_names}; 
     95    my ($dbh) = @_; 
     96    return 1 if exists $dbh->{private_set_names}; 
    9397 
    9498    my $cfg = MT->config; 
    9599    my $set_names = $cfg->SQLSetNames; 
    96     $driver->{set_names} = 1; 
     100    $dbh->{private_set_names} = 1; 
    97101    return 1 if (defined $set_names) && !$set_names; 
    98102 
  • 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};