function __construct($config = array()) { if (empty($config)) { $config = array('server' => 'localhost', 'user' => 'root', 'password' => '', 'database' => 'test'); } parent::__construct($config['server'], $config['user'], $config['password'], $config['database']); }
public function __construct() { $this->user = '******'; $this->pass = '******'; $this->db = 'Objectedb'; parent::__construct('localhost', $this->user, $this->pass, $this->db); }
function __construct($host = NULL, $username = NULL, $passwd = NULL, $dbname = NULL, $port = NULL, $socket = NULL) { $this->_host = is_null($host) ? $this->_host : $host; $this->_username = is_null($username) ? $this->_username : $username; $this->_passwd = is_null($passwd) ? $this->_passwd : $passwd; $this->_dbname = is_null($dbname) ? $this->_dbname : $dbname; $this->_port = is_null($port) ? $this->_port : $port; $this->_socket = is_null($socket) ? $this->_socket : $socket; parent::__construct($this->_host, $this->_username, $this->_passwd, $this->_dbname, $this->_port); return $this; }
/** * Constructor. * * @param array $options Array of database options with keys: host, user, password, database, select. * */ public function __construct($options) { // Get some basic values from the options. $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'] : ''; $options['select'] = isset($options['select']) ? (bool) $options['select'] : true; // Finalize initialisation. parent::__construct($options); }
public function __construct($host, $user, $pass, $db) { @parent::__construct($host, $user, $pass, $db); try { if ($this->connect_error) { throw new Exception("Error: {$this->connect_error}"); } } catch (Exception $e) { Helper::errorHandler($e->getMessage()); } }
/** * Инициализирует объект Mysqli * * @return void */ public function __construct($data = []) { if (!empty($data)) { extract($data); if (!isset($host, $user, $pass, $base)) { throw new \InvalidArgumentException('Component Mysqli: wrong data connection in the configuration file', E_USER_WARNING); } $this->debugger = $debugger; } parent::__construct($host, $user, $pass, $base); if (!$this->connect_error) { $this->set_charset("utf8"); } }
public function connect() { if ($this->link === null) { if ($this->cfg['socket'] !== null) { $host = $this->cfg['socket']; } else { $host = "{$this->cfg['host']}:{$this->cfg['port']}"; } if (!($this->link = parent::__construct($this->cfg['host'], $this->cfg['user'], $this->cfg['passwd'], $this->cfg['dbname'], $this->cfg['port'], $this->cfg['socket']))) { if (__CFG::DEBUG) { trigger_error('Mysql Connect:[' . mysql_errno() . ']' . mysql_error()); } trigger_error('Mysql Connect Error'); } else { parent::query('SET NAMES UTF8'); if ($this->version() > '4.1') { parent::query("SET SQL_MODE=''"); } } } return $this->link; }
public function __construct() { parent::__construct('localhost', 'root', 'root', 'zf2online'); }
public function __construct() { parent::__construct(DB_HOST, DB_USER, DB_PASS, DB_NAME, NULL, NULL); }
public function __construct($options) { parent::__construct($options['host'], '', '', '', $options['port']); }
public function __construct() { parent::__construct("localhost", 'root', '', 'restFull'); }