<commit_before><?php
/* ===========================================================================
 * Opis Project
 * http://opis.io
 * ===========================================================================
 * Copyright 2013 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============================================================================ */

namespace Opis\Database;

use PDO;
use Closure;
use PDOException;
use RuntimeException;
use Opis\Database\Connection;
use Opis\Database\SQL\Query as QueryCommand;
use Opis\Database\SQL\Insert as InsertCommand;
use Opis\Database\SQL\Update as UpdateCommand;

class Database
{
    /** @var    \PDO    PDO instance. */
    protected $pdo;

    /** @var    \Opis\Database\Connection   Connection instance. */
    protected $connection;

    /** @var    boolean Enable log flag. */
    protected $enableLog;

    /** @var    array   Query log. */
    protected $log = array();
    
    /**
     * Constructor
     *
     * @access  public
     * 
     * @param   \Opis\Database\Connection   $connection Connection instance.
     */
    
    public function __construct(Connection $connection)
    {
        $this->connection = $connection;
        $this->pdo = $connection->pdo();
        $this->enableLog = $connection->loggingEnabled();
    }

    /**
     * Returns a new instance of the compiler associated with this database
     *
     * @access  public
     *
     * @return  \Opis\Database\SQL\Compiler;
     */

    public function getCompiler()
    {
        return $this->connection->compiler();
    }

    /**
     * Enables or disable the query log.
     *
     * @access public<commit_msg>Added getConnection method<commit_after><?php
/* ===========================================================================
 * Opis Project
 * http://opis.io
 * ===========================================================================
 * Copyright 2013 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============================================================================ */

namespace Opis\Database;

use PDO;
use Closure;
use PDOException;
use RuntimeException;
use Opis\Database\Connection;
use Opis\Database\SQL\Query as QueryCommand;
use Opis\Database\SQL\Insert as InsertCommand;
use Opis\Database\SQL\Update as UpdateCommand;

class Database
{
    /** @var    \PDO    PDO instance. */
    protected $pdo;

    /** @var    \Opis\Database\Connection   Connection instance. */
    protected $connection;

    /** @var    boolean Enable log flag. */
    protected $enableLog;

    /** @var    array   Query log. */
    protected $log = array();
    
    /**
     * Constructor
     *
     * @access  public
     * 
     * @param   \Opis\Database\Connection   $connection Connection instance.
     */
    
    public function __construct(Connection $connection)
    {
        $this->connection = $connection;
        $this->pdo = $connection->pdo();
        $this->enableLog = $connection->loggingEnabled();
    }

    /**
     * Returns a new instance of the compiler associated with this database
     *
     * @access  public
     *
     * @return  \Opis\Database\SQL\Compiler;
     */

    public function getCompiler()
    {
        return $this->connection->compiler();
    }
    
    /**
    * Get connection
    */
    
    public function getConnection()
    {
        return $this->connection;
    }

    /**
     * Enables or disable the query log.
     *
     * @access public
{'fraction_non_alphanumeric': 0.1953281423804227, 'fraction_numerical': 0.003559510567296997, 'mean_word_length': 2.9027777777777777, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5121092', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1125, 'n_words': 374}