public function __construct($dsn, $username = null, $password = null, $driver_options = array())
 {
     if (isset($driver_options[self::KALTURA_ATTR_NAME])) {
         $this->connectionName = $driver_options[self::KALTURA_ATTR_NAME];
     }
     list($mysql, $connection) = explode(':', $dsn);
     $arguments = explode(';', $connection);
     foreach ($arguments as $argument) {
         list($argumentName, $argumentValue) = explode('=', $argument);
         if (strtolower($argumentName) == 'host') {
             $this->hostName = $argumentValue;
             break;
         }
     }
     $connStart = microtime(true);
     parent::__construct($dsn, $username, $password, $driver_options);
     KalturaLog::debug("conn took - " . (microtime(true) - $connStart) . " seconds to {$dsn}");
     $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('KalturaStatement'));
 }
Example #2
0
 public function __construct($dsn, $username = null, $password = null, $driver_options = array(), $config_key = null)
 {
     if (isset($driver_options[KalturaPDO::KALTURA_ATTR_NAME])) {
         $this->connectionName = $driver_options[KalturaPDO::KALTURA_ATTR_NAME];
         $this->kalturaOptions = DbManager::getKalturaConfig($this->connectionName);
     }
     list($mysql, $connection) = explode(':', $dsn);
     $arguments = explode(';', $connection);
     foreach ($arguments as $argument) {
         list($argumentName, $argumentValue) = explode('=', $argument);
         if (strtolower($argumentName) == 'host') {
             $this->hostName = $argumentValue;
             break;
         }
     }
     $this->configKey = $config_key;
     $connStart = microtime(true);
     parent::__construct($dsn, $username, $password, $driver_options);
     $connTook = microtime(true) - $connStart;
     KalturaLog::debug("conn took - {$connTook} seconds to {$dsn}");
     KalturaMonitorClient::monitorConnTook($dsn, $connTook);
     $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('KalturaStatement'));
 }
Example #3
0
 public function __construct($dsn, $username = null, $password = null, $driver_options = array())
 {
     parent::__construct($dsn, $username, $password, $driver_options);
     $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('KalturaStatement'));
 }
Example #4
0
 /**
  * Creates a DebugPDO instance representing a connection to a database.
  *
  * This method is overridden in order to specify a custom PDOStatement class and to implement logging.
  *
  * @param      string $dsn Connection DSN.
  * @param      string $username (optional) The user name for the DSN string.
  * @param      string $password (optional) The password for the DSN string.
  * @param      array $driver_options (optional) A key=>value array of driver-specific connection options.
  * @throws     PDOException if there is an error during connection initialization.
  */
 public function __construct($dsn, $username = null, $password = null, $driver_options = array())
 {
     $debug = $this->getDebugSnapshot();
     parent::__construct($dsn, $username, $password, $driver_options);
     $this->configureStatementClass($suppress = true);
     $this->log('', null, __METHOD__, $debug);
 }
Example #5
0
 public function __construct($dsn, $username = null, $password = null, $driver_options = array())
 {
     parent::__construct($dsn, $username, $password, $driver_options);
     $this->classId = md5($dsn . ',' . $username . ',' . $password . ',' . implode(',', $driver_options));
 }
Example #6
0
 /**
  * Construct a new DebugPDO connection.
  *
  * This method is overridden in order to specify a custom PDOStatement class.
  *
  * @param      string $dsn Connection DSN
  * @param      string $username (optional
  * @param      string $password
  * @param      array $driver_options
  * @throws     PDOException - if there is an error during connection initialization
  */
 public function __construct($dsn, $username = null, $password = null, $driver_options = array())
 {
     parent::__construct($dsn, $username, $password, $driver_options);
     $this->configureStatementClass($suppress = true);
 }