/**
  * This special constructor reuses the existing resource from the existing db connecton
  *
  * @param unknown_type $options
  */
 function __construct($options)
 {
     $db = JFactory::getDBO();
     // support for recovery of existing connections (Martin N. Brampton)
     if (isset($this->options)) {
         $this->options = $options;
     }
     $select = array_key_exists('select', $options) ? $options['select'] : true;
     $database = array_key_exists('database', $options) ? $options['database'] : '';
     // perform a number of fatality checks, then return gracefully
     if (!function_exists('mysqli_connect')) {
         $this->errorNum = 1;
         $this->errorMsg = 'The MySQL adapter "mysqli" is not available.';
         return;
     }
     // connect to the server
     $this->connection = $db->get("connection");
     // finalize initialization
     parent::__construct($options);
     // select the database
     if ($select) {
         $this->select($database);
     }
 }
示例#2
0
 function __construct($host = 'localhost', $user, $password, $database = '', $prefix = '', $offline = true)
 {
     $options = array('host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix);
     parent::__construct($options);
 }