<commit_before><?php

/**
 * db.pg.class.php
 *
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2006, <NAME>
 * @version 0.1
 */
/**
 */
include_once( 'setup.inc.php' );
include_once( 'migrations.php' );

/**
 * factory method to get the single instance of the object
 *
 * @param string $mode 'read'|'write'
 *
 * @return DB singleton instance
 *
 * @todo every PHP script can get write access to the database calling getDB( 'write' ), should it be restricted?
 *  possible 'solution':  different include paths for HTTPS and HTTP, HTTP-includes only contain SQL-read login...
 */
function &getDB( $mode = 'read' )
{
	static $singleton_database;
	if ( !isset( $singleton_database ) )
	{
		$singleton_database = new DB( $mode );
	}
	return $singleton_database;
}

/**
 * DB
 *
 * provides access to the database and some specific methods
 *
 * @todo every PHP script can get write access to the database calling DB( 'write' )
 * @see getDB()
 */
class DB
{
	/**#@+
	 * @var string
	 * @access private
	 */
	var $host;
	var $user;
	var $pw;
	var $db;
	var $handle;

    var $debug = true;

	/**
	 * Constructor
	 */  
	function DB( $mode = 'read' )
	{
		global $db_host, $db_user, $db_pw, $db_db;
		$this->host = $db_host[ $mode ];
		$this->user = $db_user[ $mode ];
		$this->pw = $db_pw[ $mode ];
		$this->db = $db_db[ $mode ];
		
		$this->handle = pg_connect( 'host='.$this->host.' port=5432 dbname='.$this->db.' user='.$this->user.' password= '.$this->pw ) or die( pg_last_error() );

		$this->migrate();
	}
	/**#@-*/
	
	/**
	 * get the last error if there was one
	 *
	 * @return string
	 */
	function getError()
	{
		return pg_last_error();<commit_msg>Turn off very verbose logging to Apache's error log<commit_after><?php

/**
 * db.pg.class.php
 *
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2006, <NAME>
 * @version 0.1
 */
/**
 */
include_once( 'setup.inc.php' );
include_once( 'migrations.php' );

/**
 * factory method to get the single instance of the object
 *
 * @param string $mode 'read'|'write'
 *
 * @return DB singleton instance
 *
 * @todo every PHP script can get write access to the database calling getDB( 'write' ), should it be restricted?
 *  possible 'solution':  different include paths for HTTPS and HTTP, HTTP-includes only contain SQL-read login...
 */
function &getDB( $mode = 'read' )
{
	static $singleton_database;
	if ( !isset( $singleton_database ) )
	{
		$singleton_database = new DB( $mode );
	}
	return $singleton_database;
}

/**
 * DB
 *
 * provides access to the database and some specific methods
 *
 * @todo every PHP script can get write access to the database calling DB( 'write' )
 * @see getDB()
 */
class DB
{
	/**#@+
	 * @var string
	 * @access private
	 */
	var $host;
	var $user;
	var $pw;
	var $db;
	var $handle;

    var $debug = false;

	/**
	 * Constructor
	 */  
	function DB( $mode = 'read' )
	{
		global $db_host, $db_user, $db_pw, $db_db;
		$this->host = $db_host[ $mode ];
		$this->user = $db_user[ $mode ];
		$this->pw = $db_pw[ $mode ];
		$this->db = $db_db[ $mode ];
		
		$this->handle = pg_connect( 'host='.$this->host.' port=5432 dbname='.$this->db.' user='.$this->user.' password= '.$this->pw ) or die( pg_last_error() );

		$this->migrate();
	}
	/**#@-*/
	
	/**
	 * get the last error if there was one
	 *
	 * @return string
	 */
	function getError()
	{
		return pg_last_error();
{'fraction_non_alphanumeric': 0.1726597325408618, 'fraction_numerical': 0.005943536404160475, 'mean_word_length': 3.2770012706480305, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 31, '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': '6569693', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1191, 'n_words': 355}