src/Db.php
public function connect() {
		if (!$this->connected) {
			if ($this->config['host']{0} == '/') {
				$connector = $this->config['driver'].':unix_socket='.$this->config['host'].';dbname='.$this->config['db'];
			} else {
				$connector = $this->config['driver'].':host='.$this->config['host'].';dbname='.$this->config['db'];
			}
			
			// sqlite
			if ($this->config['driver'] == 'sqlite') {
				$connector = $this->config['driver'].':'.$this->config['file'].'';
			}
			
			parent::__construct($connector, $this->config['user'], $this->config['pass']);

			$this -> setAttribute(\PDO::ATTR_CASE, \PDO::CASE_NATURAL); // leave column names as returned by the database driver
			$this -> setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); // on errors we want to get \Exceptions

			// set encoding
			if (isset($this->config['encoding']) && $this->config['driver'] != 'sqlite') {
				parent::exec('SET NAMES '.$this->config['encoding']);
			}

			$this->connected = true;
		}
	}
public function connect() {
		if (!$this->connected) {
			if ($this->config['host']{0} == '/') {
				$connector = $this->config['driver'].':unix_socket='.$this->config['host'].';dbname='.$this->config['db'];
			} else {
				$connector = $this->config['driver'].':host='.$this->config['host'].';dbname='.$this->config['db'];
			}
			
			// sqlite
			if ($this->config['driver'] == 'sqlite') {
				$connector = $this->config['driver'].':'.$this->config['file'].'';
			}
			
			parent::__construct($connector, $this->config['user'], $this->config['pass']);

			$this -> setAttribute(\PDO::ATTR_CASE, \PDO::CASE_NATURAL); // leave column names as returned by the database driver
			$this -> setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); // on errors we want to get \Exceptions

			// set encoding
			if (isset($this->config['encoding']) && $this->config['driver'] != 'sqlite') {
				parent::exec('SET NAMES '.$this->config['encoding']);
			}

			$this->connected = true;
		}
	}
public function connect ( ) { if ( ! $ this -> connected ) { if ( $ this -> config [ 'host' ] { 0 } == '/' ) { $ connector = $ this -> config [ 'driver' ] . ':unix_socket=' . $ this -> config [ 'host' ] . ';dbname=' . $ this -> config [ 'db' ] ; } else { $ connector = $ this -> config [ 'driver' ] . ':host=' . $ this -> config [ 'host' ] . ';dbname=' . $ this -> config [ 'db' ] ; } // sqlite if ( $ this -> config [ 'driver' ] == 'sqlite' ) { $ connector = $ this -> config [ 'driver' ] . ':' . $ this -> config [ 'file' ] . '' ; } parent :: __construct ( $ connector , $ this -> config [ 'user' ] , $ this -> config [ 'pass' ] ) ; $ this -> setAttribute ( \ PDO :: ATTR_CASE , \ PDO :: CASE_NATURAL ) ; // leave column names as returned by the database driver $ this -> setAttribute ( \ PDO :: ATTR_ERRMODE , \ PDO :: ERRMODE_EXCEPTION ) ; // on errors we want to get \Exceptions // set encoding if ( isset ( $ this -> config [ 'encoding' ] ) && $ this -> config [ 'driver' ] != 'sqlite' ) { parent :: exec ( 'SET NAMES ' . $ this -> config [ 'encoding' ] ) ; } $ this -> connected = true ; } }
Connects to the Database.

Because we added Lazy initialization to PDO you only have to call this method if you use PDOs own functions and you did not call any of our methods before.

@return null
Connects to the Database .