src/SQL.php
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");
	}
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");
	}
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" ) ; }
Open PDO connection.
Open PDO connection .