コード例 #1
0
 public function __construct(array $options)
 {
     parent::__construct($options);
     if (!is_object($this->connection)) {
         $this->open();
     }
 }
コード例 #2
0
ファイル: Mysql.php プロジェクト: brenot/forumdesenvolvimento
 /**
  * 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();
     }
 }
コード例 #3
0
ファイル: Sqlite.php プロジェクト: AlexanderKri/joom-upd
 public function __construct(array $options)
 {
     $this->driverType = 'sqlite';
     parent::__construct($options);
     if (!is_object($this->connection)) {
         $this->open();
     }
 }
コード例 #4
0
ファイル: Postgresql.php プロジェクト: kidaa30/lojinha
 /**
  * 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();
     }
 }
コード例 #5
0
ファイル: Sqlsrv.php プロジェクト: AlexanderKri/joom-upd
 /**
  * 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();
     }
 }