original_string: private function open_pdo_connection() {
  		try {
  			$this->connection = in_array(
  					$this->dbtype, ['sqlite3', 'pgsql'])
  				? new \PDO($this->connection_string)
  				: new \PDO(
  					$this->connection_string,
  					$this->dbuser, $this->dbpass);
  			self::$logger->debug(sprintf(
  				"SQL: connection opened: '%s'.",
  				json_encode($this->verified_params)));
  		} catch (\PDOException $e) {
  			self::$logger->error(sprintf(
  				"SQL: connection failed: '%s'.",
  				json_encode($this->verified_params)));
  			throw new SQLError(SQLError::CONNECTION_ERROR,
  				$this->dbtype . " connection error.");
  		}
  
  		$this->connection->setAttribute(
  			\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
  
  		# set pragma for SQLite3
  		if ($this->dbtype == 'sqlite3')
  			$this->connection->exec("PRAGMA foreign_keys=ON");
  	}
code: private function open_pdo_connection() {
  		try {
  			$this->connection = in_array(
  					$this->dbtype, ['sqlite3', 'pgsql'])
  				? new \PDO($this->connection_string)
  				: new \PDO(
  					$this->connection_string,
  					$this->dbuser, $this->dbpass);
  			self::$logger->debug(sprintf(
  				"SQL: connection opened: '%s'.",
  				json_encode($this->verified_params)));
  		} catch (\PDOException $e) {
  			self::$logger->error(sprintf(
  				"SQL: connection failed: '%s'.",
  				json_encode($this->verified_params)));
  			throw new SQLError(SQLError::CONNECTION_ERROR,
  				$this->dbtype . " connection error.");
  		}
  
  		$this->connection->setAttribute(
  			\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
  
  		# set pragma for SQLite3
  		if ($this->dbtype == 'sqlite3')
  			$this->connection->exec("PRAGMA foreign_keys=ON");
  	}
code_tokens: private function open_pdo_connection ( ) { try { $ this -> connection = in_array ( $ this -> dbtype , [ 'sqlite3' , 'pgsql' ] ) ? new \ PDO ( $ this -> connection_string ) : new \ PDO ( $ this -> connection_string , $ this -> dbuser , $ this -> dbpass ) ; self :: $ logger -> debug ( sprintf ( "SQL: connection opened: '%s'." , json_encode ( $ this -> verified_params ) ) ) ; } catch ( \ PDOException $ e ) { self :: $ logger -> error ( sprintf ( "SQL: connection failed: '%s'." , json_encode ( $ this -> verified_params ) ) ) ; throw new SQLError ( SQLError :: CONNECTION_ERROR , $ this -> dbtype . " connection error." ) ; } $ this -> connection -> setAttribute ( \ PDO :: ATTR_ERRMODE , \ PDO :: ERRMODE_EXCEPTION ) ; # set pragma for SQLite3 if ( $ this -> dbtype == 'sqlite3' ) $ this -> connection -> exec ( "PRAGMA foreign_keys=ON" ) ; }
docstring: Open PDO connection.
docstring_tokens: Open PDO connection .