Beispiel #1
0
 /**
  * The options are:
  * - debug_level: level of debug if it's not specified it's set by debugObject to DEBUG_DEFAULT_LEVEL
  * - dsn: the Data Source Name to connect to a database through PEAR::MDB2 {@link http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php}.
  *   The DSN must be provided as an associative array or as a string.
  *   The array format is preferred, since it doesn't require a further parsing step (see the {@link http://pear.php.net/manual/en/package.database.mdb2.intro-connect.php Connecting
  *   chapter} for an example). The string format of the supplied DSN is in its fullest form:
  *   phptype(dbsyntax)://username:password@protocol+hostspec/database?option=value 
  *   Examples:
  *   $dsn =  'mysqli://*****:*****@localhost/masterdb'
  *   $dsn = array(
  *		'phptype'  => 'mysqli',
  *		'username' => 'themaster',
  *		'password' => 'thepowerofthepower',
  *		'hostspec' => 'localhost',
  *		'database' => 'masterdb'
  *	); 
  * - mdb2_options: can contain runtime configuration settings for the MDB2 package (see the {@link http://pear.php.net/manual/en/package.database.mdb2.intro-connect.php Connecting} for more details).
  * - table: the name of the table where debug logs are stored. 
  *
  * @param array $options
  * @throws BadMethodCallException
  * @throws exceptions
  */
 public function __construct($options = null)
 {
     $this->_dsn = isset($options['dsn']) ? $options['dsn'] : DEBUG_DEFAULT_MYSQL_DSN;
     $this->_table = isset($options['table']) ? $options['table'] : DEBUG_DEFAULT_MYSQL_TABLE;
     $this->_mdb2_options = isset($options['mdb2_options']) ? $options['mdb2_options'] : array();
     parent::__construct($options);
     $this->_mdb2 =& MDB2::factory($this->_dsn, $this->_mdb2_options);
     if (PEAR::isError($this->_mdb2)) {
         throw new exceptions($this->_mdb2->getMessage(), $this->_mdb2->getCode());
     }
 }