Ejemplo n.º 1
0
 public function __construct(array $options)
 {
     parent::__construct($options);
     if (!is_object($this->connection)) {
         $this->open();
     }
 }
Ejemplo n.º 2
0
 /**
  * Database object constructor
  *
  * @param   array  $options  List of options used to configure the connection
  */
 public function __construct($options)
 {
     $this->driverType = 'mysql';
     // Init
     $this->nameQuote = '`';
     $host = array_key_exists('host', $options) ? $options['host'] : 'localhost';
     $port = array_key_exists('port', $options) ? $options['port'] : '';
     $user = array_key_exists('user', $options) ? $options['user'] : '';
     $password = array_key_exists('password', $options) ? $options['password'] : '';
     $database = array_key_exists('database', $options) ? $options['database'] : '';
     $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : '';
     $select = array_key_exists('select', $options) ? $options['select'] : true;
     if (!empty($port)) {
         $host .= ':' . $port;
     }
     // finalize initialization
     parent::__construct($options);
     // Open the connection
     $this->host = $host;
     $this->user = $user;
     $this->password = $password;
     $this->_database = $database;
     $this->selectDatabase = $select;
     if (!is_resource($this->connection) || is_null($this->connection)) {
         $this->open();
     }
 }
Ejemplo n.º 3
0
 public function __construct(array $options)
 {
     $this->driverType = 'sqlite';
     parent::__construct($options);
     if (!is_object($this->connection)) {
         $this->open();
     }
 }
Ejemplo n.º 4
0
 /**
  * Database object constructor
  *
  * @param   array $options List of options used to configure the connection
  *
  */
 public function __construct($options)
 {
     $this->driverType = 'postgresql';
     $options['host'] = isset($options['host']) ? $options['host'] : 'localhost';
     $options['user'] = isset($options['user']) ? $options['user'] : '';
     $options['password'] = isset($options['password']) ? $options['password'] : '';
     $options['database'] = isset($options['database']) ? $options['database'] : '';
     $host = array_key_exists('host', $options) ? $options['host'] : 'localhost';
     $port = array_key_exists('port', $options) ? $options['port'] : '';
     $user = array_key_exists('user', $options) ? $options['user'] : '';
     $password = array_key_exists('password', $options) ? $options['password'] : '';
     $database = array_key_exists('database', $options) ? $options['database'] : '';
     $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : '';
     $select = array_key_exists('select', $options) ? $options['select'] : true;
     // Finalize initialization
     parent::__construct($options);
     if (!is_resource($this->connection) || is_null($this->connection)) {
         $this->open();
     }
 }
Ejemplo n.º 5
0
 /**
  * Constructor.
  *
  * @param   array $options List of options used to configure the connection
  *
  * @since   11.1
  */
 public function __construct($options)
 {
     $this->driverType = 'mssql';
     // Get some basic values from the options.
     $host = array_key_exists('host', $options) ? $options['host'] : 'localhost';
     $port = array_key_exists('port', $options) ? $options['port'] : '';
     $user = array_key_exists('user', $options) ? $options['user'] : '';
     $password = array_key_exists('password', $options) ? $options['password'] : '';
     $database = array_key_exists('database', $options) ? $options['database'] : '';
     $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : '';
     $select = array_key_exists('select', $options) ? $options['select'] : true;
     // Build the connection configuration array.
     $this->connectionConfig = array('Database' => $database, 'uid' => $user, 'pwd' => $password, 'CharacterSet' => 'UTF-8', 'ReturnDatesAsStrings' => true);
     parent::__construct($options);
     $this->host = $host;
     $this->user = $user;
     $this->password = $password;
     $this->_database = $database;
     $this->selectDatabase = $select;
     if (!is_resource($this->connection)) {
         $this->open();
     }
 }