<commit_before><?php
/**
 * JBZoo CrossCMS
 *
 * This file is part of the JBZoo CCK package.
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @package   CrossCMS
 * @license   MIT
 * @copyright Copyright (C) JBZoo.com,  All rights reserved.
 * @link      https://github.com/JBZoo/CrossCMS
 * @author    <NAME> <<EMAIL>>
 */

namespace JBZoo\CrossCMS;

use JBZoo\SqlBuilder\Query\Query;

/**
 * Class AbstractDatabase
 * @package JBZoo\CrossCMS
 */
abstract class AbstractDatabase extends AbstractHelper
{
    protected $_pseudoPrefix = '#__';

    /**
     * @return string
     */
    abstract public function getPrefix();

    /**
     * @param  string|Query $sql
     * @return int|bool
     */
    abstract public function query($sql);

    /**
     * @param  string|Query $sql
     * @return mixed
     */
    abstract public function fetchAll($sql);

    /**
     * @param  string|Query $sql
     * @return mixed
     */
    abstract public function fetchRow($sql);

    /**
     * @param  string|Query $sql
     * @return mixed
     */
    abstract public function fetchArray($sql);

    /**
     * @param  string $text
     * @return mixed
     */
    abstract public function escape($text);

    /**
     * @return int
     */
    abstract public function insertId();

    /**
     * @param string|Query $sql
     * @return string
     */
    protected function _prepareSql($sql)
    {
        $sql = (string)$sql;
        $sql = str_replace($this->_pseudoPrefix, $this->getPrefix(), $sql);

        return $sql;
    }
}
<commit_msg>new functions for database helper<commit_after><?php
/**
 * JBZoo CrossCMS
 *
 * This file is part of the JBZoo CCK package.
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @package   CrossCMS
 * @license   MIT
 * @copyright Copyright (C) JBZoo.com,  All rights reserved.
 * @link      https://github.com/JBZoo/CrossCMS
 * @author    <NAME> <<EMAIL>>
 */

namespace JBZoo\CrossCMS;

use JBZoo\SqlBuilder\Query\Query;
use JBZoo\SqlBuilder\SqlBuilder;

/**
 * Class AbstractDatabase
 * @package JBZoo\CrossCMS
 */
abstract class AbstractDatabase extends AbstractHelper
{
    protected $_pseudoPrefix = '#__';

    /**
     * @return string
     */
    abstract public function getPrefix();

    /**
     * @param  string|Query $sql
     * @return int|bool
     */
    abstract public function query($sql);

    /**
     * @param  string|Query $sql
     * @return mixed
     */
    abstract public function fetchAll($sql);

    /**
     * @param  string|Query $sql
     * @return mixed
     */
    abstract public function fetchRow($sql);

    /**
     * @param  string|Query $sql
     * @return mixed
     */
    abstract public function fetchArray($sql);

    /**
     * @param  string $text
     * @return mixed
     */
    abstract public function escape($text);

    /**
     * @return int
     */
    abstract public function insertId();

    /**
     * Quotes and optionally escapes a string to database requirements for use in database queries.
     *
     * @param   mixed   $text   A string or an array of strings to quote.
     * @param   boolean $escape True (default) to escape the string, false to leave it unchanged.
     * @return  string
     *
     * @codeCoverageIgnore
     */
    public function quote($text, $escape = true)
    {
        return SqlBuilder::get()->quote($text, $escape);
    }

    /**
     * Wrap an SQL statement identifier name such as column, table or database names in quotes to prevent injection
     * risks and reserved word conflicts.
     *
     * @param   string $name
     * @param   string $alias
     * @return  mixed
     *
     * @codeCoverageIgnore
     */
    public function quoteName($name, $alias = null)
    {
        return SqlBuilder::get()->quoteName($name, $alias);
    }

    /**
     * @param string $condition
     * @param string $value
     * @return string
     *
     * @codeCoverageIgnore
     */
    public function clean($condition, $value = null)
    {
        return SqlBuilder::get()->clean($condition, $value);
    }

    /**
     * @param string|Query $sql
     * @return string
     */
    protected function _prepareSql($sql)
    {
        $sql = (string)$sql;
        $sql = str_replace($this->_pseudoPrefix, $this->getPrefix(), $sql);

        return $sql;
    }
}

{'fraction_non_alphanumeric': 0.11938958707360861, 'fraction_numerical': 0.0, 'mean_word_length': 2.348610067618332, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 16, 'https://': 2, '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': '3361656', 'n_tokens_mistral': 1328, 'n_tokens_neox': 1290, 'n_words': 384}