<commit_before><?php

/**
 * Created by PhpStorm.
 * User: Riza
 * Date: 5/12/14
 * Time: 11:49 PM
 */
class Database
{

	private $connection;

	/**
	 * @param mysql :host=localhost
	 *   1st part of string: type of database
	 *   2nd depending on type of db, on this case host=.
	 *   3rd name of database
	 *   4th if sql uses default port, this is not need. else you need to specify it like:
	 * Probably this exception should be emailed to programmers.
	 *
	 * @param $database
	 * @throws Exception error message -- could not connect to database.
	 */
	public function __construct() {
		try { // connects to database
			$this->setConnection(new PDO("mysql:host=" . DB_HOST . ";dbname=" . DB_NAME . ";port=" . DB_PORT, DB_USER, DB_PASS));
			$this->getConnection()->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // CHANGE THE ERROR MODE, THROW AN EXCEPTION WHEN AN ERROR IS FOUND
			$this->getConnection()->exec("SET NAMES 'utf8'");
		} catch (PDOException $e) { // program ends if exception is found
			throw new Exception("Could not connect to the database.");
		} // end

	}
<commit_msg>Disable errors for production server.<commit_after><?php

/**
 * Created by PhpStorm.
 * User: Riza
 * Date: 5/12/14
 * Time: 11:49 PM
 */
class Database
{

	private $connection;

	/**
	 * @param mysql :host=localhost
	 *   1st part of string: type of database
	 *   2nd depending on type of db, on this case host=.
	 *   3rd name of database
	 *   4th if sql uses default port, this is not need. else you need to specify it like:
	 * Probably this exception should be emailed to programmers.
	 *
	 * @param $database
	 * @throws Exception error message -- could not connect to database.
	 */
	public function __construct() {
		try { // connects to database
			$this->setConnection(new PDO("mysql:host=" . DB_HOST . ";dbname=" . DB_NAME . ";port=" . DB_PORT, DB_USER, DB_PASS));
			$this->getConnection()->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
			$this->getConnection()->exec("SET NAMES 'utf8'");
		} catch (PDOException $e) { // program ends if exception is found
			throw new Exception("Could not connect to the database.");
		} // end

	}

{'fraction_non_alphanumeric': 0.12575127138233935, 'fraction_numerical': 0.012944983818770227, 'mean_word_length': 3.389452332657201, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6634425', 'n_tokens_mistral': 723, 'n_tokens_neox': 653, 'n_words': 244}