<commit_before><?php

namespace Asymptix\db;

use Asymptix\core\Tools;

/**
 * Complex DB query object for Prepared Statement.
 *
 * @category Asymptix PHP Framework
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2015 - 2016, <NAME>
 *
 * @git https://github.com/Asymptix/Framework
 * @license http://opensource.org/licenses/MIT
 */
class DBPreparedQuery extends DBQuery {

    /**
     * DB query template.
     *
     * @var string
     */
    public $query = "";

    /**
     * Parameters SQL types string ("idsb").
     *
     * @var string
     */
    public $types = "";

    /**
     * List of the DB SQL query parameters.
     *
     * @var array
     */
    public $params = [];

    /**
     * Creates and initialize DBPreparedQuery object.
     *
     * @param string $query DB SQL query template.
     * @param string $types Parameters SQL types string ("idsb").
     * @param array $params List of the DB SQL query parameters.
     */
    public function __construct($query = "", $types = "", $params = []) {
        $this->query = $query;
        $this->types = $types;
        $this->params = $params;

        if (!empty($this->query)) {
            $this->type = $this->detectType();
        }
        parent::__construct($this->type);
    }

    /**
     * Verify if current DBPreparedQuery is have parameters for binding.
     *
     * @return bool
     */
    public function isBindable() {
        return ($this->params != null && count($this->params) > 0);
    }

    /**
     * Verify if current DBPreparedQuery is valid for the execution.<commit_msg>New feature: '|' separator support in the DB fields types string<commit_after><?php

namespace Asymptix\db;

use Asymptix\core\Tools;

/**
 * Complex DB query object for Prepared Statement.
 *
 * @category Asymptix PHP Framework
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2015 - 2016, <NAME>
 *
 * @git https://github.com/Asymptix/Framework
 * @license http://opensource.org/licenses/MIT
 */
class DBPreparedQuery extends DBQuery {

    /**
     * DB query template.
     *
     * @var string
     */
    public $query = "";

    /**
     * Parameters SQL types string ("idsb").
     *
     * @var string
     */
    public $types = "";

    /**
     * List of the DB SQL query parameters.
     *
     * @var array
     */
    public $params = [];

    /**
     * Creates and initialize DBPreparedQuery object.
     *
     * @param string $query DB SQL query template.
     * @param string $types Parameters SQL types string ("idsb").
     * @param array $params List of the DB SQL query parameters.
     */
    public function __construct($query = "", $types = "", $params = []) {
        $this->query = $query;
        $this->types = str_replace(["|"], "", $types);
        $this->params = $params;

        if (!empty($this->query)) {
            $this->type = $this->detectType();
        }
        parent::__construct($this->type);
    }

    /**
     * Verify if current DBPreparedQuery is have parameters for binding.
     *
     * @return bool
     */
    public function isBindable() {
        return ($this->params != null && count($this->params) > 0);
    }

    /**
     * Verify if current DBPreparedQuery is valid for the execution.
{'fraction_non_alphanumeric': 0.1448960595718275, 'fraction_numerical': 0.005584858827179647, 'mean_word_length': 2.195242814667988, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 31, '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': '5607020', 'n_tokens_mistral': 974, 'n_tokens_neox': 943, 'n_words': 275}