<commit_before><?php
/**
 * Mysql absztrakció, amely csak a sima mysql függvényeket hivogatja
 * @author <NAME>
 * @version 6
 *   
 **/
abstract class AMysql_Abstract {

    public $insertId;
    public $lastStatement;
    public $mysqlResource = null;
    public $error;
    public $errno;
    public $result;
    public $query;
    public $affectedRows;
    public $throwExceptions = true;
    
    /**
     * @constructor
     * @param resource $res A mysql kapcsolat resource-ja.
     * 
     **/                   
    public function __construct($res) {
        if ('mysql link' == get_resource_type($res)) {
            $this->mysqlResource = $res;
        }
		else {
			throw new RuntimeException('Resource given is not a mysql resource.', 0);
		}
    }
    
    /**
     * Backtickeket tesz az oszlop vagy táblanév köré
     * 
     **/          
    protected static function _escapeColumn($column) {
		$exploded = explode('.', $column);
		$count = count($exploded);
		$column = '`' . $exploded[$count-1] . '`';
		if (1 < $count) {
			$column = "`$exploded[0]`.$column";
		}
		$ret = $column;
        return $ret;
    }
    
    public static function escapeColumn($columnName, $as = null) {
		$asString = '';
		$escapeColumnName = true;
		if ($as and !is_int($as)) {
			$asString = ' AS ' . $as; 
		}
		else if (is_string($columnName) and (false !== strpos($columnName, ' AS '))) {
			$exploded = explode(' AS ', $columnName);
			$columnName = $exploded[0];
			$asString = ' AS ' . $exploded[1];
		}
		if ($columnName instanceof AMysql_Expr) {
            $ret = $columnName->__toString() . $asString;
        }
        else {
		    $ret = self::_escapeColumn($columnName) . $asString;
        }
		return $ret;
    }
    
    public static function escapeTable($tableName, $as = null) {
		$ret = self::_escapeColumn($tableName);
		if ($as and !is_int($as)) {
			$ret .= ' ' . $as; 
		}
		return $ret;
    }
    
    public function startTransaction() {
        return $this->query('START TRANSACTION');
    }
    
    public function commit() {
        return $this->query('COMMIT');
    }
    
    public function rollback() {
        return $this->query('ROLLBACK');
    }
    
    /**
     * AMysql_Exception-t dob a legutolsó Mysql hiba szöveggel és számmal.
     * 
     **/              
    public function throwException() {
        throw new AMysql_Exception($this->error, $this->errno);
    }
    
    /**
     * Végrehajt egy kérést.
     * @param string $sql A kérés stringje.
     * @return resource $result Az eredmény resource-ja.     
     **/              
    public function query($sql, $binds = null) {
        $stmt = new AMysql_Statement($this);
        $result = $stmt->query($sql, $binds);
        $this->lastStatement = $stmt;
        return $result;
    }
    
    public function prepare($sql) {
        $stmt = new AMysql_Statement($this);
        $stmt->prepare($sql);
        return $stmt;
    }<commit_msg>statement-et adjon vissza az abstract query()<commit_after><?php
/**
 * Mysql absztrakció, amely csak a sima mysql függvényeket hivogatja
 * @author <NAME>
 * @version 6
 *   
 **/
abstract class AMysql_Abstract {

    public $insertId;
    public $lastStatement;
    public $mysqlResource = null;
    public $error;
    public $errno;
    public $result;
    public $query;
    public $affectedRows;
    public $throwExceptions = true;
    
    /**
     * @constructor
     * @param resource $res A mysql kapcsolat resource-ja.
     * 
     **/                   
    public function __construct($res) {
        if ('mysql link' == get_resource_type($res)) {
            $this->mysqlResource = $res;
        }
		else {
			throw new RuntimeException('Resource given is not a mysql resource.', 0);
		}
    }
    
    /**
     * Backtickeket tesz az oszlop vagy táblanév köré
     * 
     **/          
    protected static function _escapeColumn($column) {
		$exploded = explode('.', $column);
		$count = count($exploded);
		$column = '`' . $exploded[$count-1] . '`';
		if (1 < $count) {
			$column = "`$exploded[0]`.$column";
		}
		$ret = $column;
        return $ret;
    }
    
    public static function escapeColumn($columnName, $as = null) {
		$asString = '';
		$escapeColumnName = true;
		if ($as and !is_int($as)) {
			$asString = ' AS ' . $as; 
		}
		else if (is_string($columnName) and (false !== strpos($columnName, ' AS '))) {
			$exploded = explode(' AS ', $columnName);
			$columnName = $exploded[0];
			$asString = ' AS ' . $exploded[1];
		}
		if ($columnName instanceof AMysql_Expr) {
            $ret = $columnName->__toString() . $asString;
        }
        else {
		    $ret = self::_escapeColumn($columnName) . $asString;
        }
		return $ret;
    }
    
    public static function escapeTable($tableName, $as = null) {
		$ret = self::_escapeColumn($tableName);
		if ($as and !is_int($as)) {
			$ret .= ' ' . $as; 
		}
		return $ret;
    }
    
    public function startTransaction() {
        return $this->query('START TRANSACTION');
    }
    
    public function commit() {
        return $this->query('COMMIT');
    }
    
    public function rollback() {
        return $this->query('ROLLBACK');
    }
    
    /**
     * AMysql_Exception-t dob a legutolsó Mysql hiba szöveggel és számmal.
     * 
     **/              
    public function throwException() {
        throw new AMysql_Exception($this->error, $this->errno);
    }
    
    /**
     * Végrehajt egy kérést.
     * @param string $sql A kérés stringje.
     * @return resource $result Az eredmény resource-ja.     
     **/              
    public function query($sql, array $binds = array ()) {
        $stmt = new AMysql_Statement($this);
        $result = $stmt->query($sql, $binds);
        $this->lastStatement = $stmt;
        return $stmt;
    }
    
    public function prepare($sql) {
        $stmt = new AMysql_Statement($this);
        $stmt->prepare($sql);
        return $stmt;
    }
{'fraction_non_alphanumeric': 0.14331424722128663, 'fraction_numerical': 0.0023576961940047153, 'mean_word_length': 2.1912950026867275, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 25, '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': '1747464', 'n_tokens_mistral': 2036, 'n_tokens_neox': 1948, 'n_words': 454}