Development

#2644: sfPODDatabase-persist.diff

You must first sign up to be able to contribute.

Ticket #2644: sfPODDatabase-persist.diff

File sfPODDatabase-persist.diff, 0.9 kB (added by sugi, 1 year ago)
  • sfPDODatabase.class.php

    old new  
    5151      $pdo_username = $this->getParameter('username'); 
    5252      $pdo_password = $this->getParameter('password'); 
    5353      $pdo_class    = $this->getParameter('class', 'PDO'); 
     54      $pdo_persist  = $this->getParameter('persistent'); 
     55      $pdo_opts     = array(); 
    5456 
    55       $this->connection = new $pdo_class($dsn, $pdo_username, $pdo_password); 
     57      if ($pdo_persist !== null) 
     58      { 
     59        if (defined('PDO::ATTR_PERSISTENT')) 
     60        { 
     61          $pdo_opts[PDO::ATTR_PERSISTENT] = $pdo_persist; 
     62        } 
     63        else 
     64        { 
     65          $pdo_opts[PDO_ATTR_PERSISTENT] = $pdo_persist; 
     66        } 
     67      } 
     68 
     69      $this->connection = new $pdo_class($dsn, $pdo_username, $pdo_password, $pdo_opts); 
    5670    } 
    5771    catch (PDOException $e) 
    5872    {