<commit_before><?php
/**
 * KumbiaPHP web & app Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://wiki.kumbiaphp.com/Licencia
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to <EMAIL> so we can send you a copy immediately.
 *
 * @category   Kumbia
 * @package    Db
 * @copyright  Copyright (c) 2005-2012 Kumbia Team (http://www.kumbiaphp.com)
 * @license    http://wiki.kumbiaphp.com/Licencia     New BSD License
 */
/**
 * @see DbBaseInterface
 */
require_once dirname(__FILE__) . '/db_base_interface.php';
/**
 * @see DbBase
 */
require_once dirname(__FILE__) . '/db_base.php';

/**
 * Clase que maneja el pool de conexiones
 *
 * @category   Kumbia
 * @package    Db
 */
class Db
{

    /**
     * Singleton de conexiones a base de datos
     *
     * @var array
     */
    protected static $_connections = array();

    /**
     * Devuelve la conexión, si no existe llama a Db::connect para crearla
     *
     * @param boolean $new nueva conexion //TODO mirar si es necesaria
     * @param string $database base de datos a donde conectar
     * @return db
     */
    public static function factory($database = null, $new = false)
    {

        //Cargo el mode para mi aplicacion
        if (!$database) {
            $database = Config::get('config.application.database');
        }
        //Si no es una conexion nueva y existe la conexion singleton
        if (isset(self::$_connections[$database])) {
            return self::$_connections[$database];
        }

        return self::$_connections[$database] = self::connect($database);
    }

    /**
     * Realiza una conexión directa al motor de base de datos
     * usando el driver de Kumbia
     *
     * @param string $database base de datos a donde conectar
     * @return db
     */
    private static function connect($database)
    {
        $databases = Config::read('databases');
        $config = $databases[$database];

        // carga los valores por defecto para la conexión, si no existen
        $default = array('port' => 0, 'dsn' => NULL, 'dbname' => NULL, 'host' => 'localhost', 'username' => NULL, 'password' => <PASSWORD>);
        $config = $config + $default;
        $path = dirname(__FILE__); 

        //Si usa PDO
        if (isset($config['pdo'])) {
            $dbclass = "DbPdo{$config['type']}";
            $db_file = "$path/adapters/pdo/{$config['type']}.php";
        } else {
            if($config['type'] = 'mysql') $config['type'] = 'mysqli';
            $dbclass = "Db{$config['type']}";
            $db_file = "$path/adapters/{$config['type']}.php";
        }

        //Carga la clase adaptadora necesaria
        if (!include_once $db_file) {
            throw new KumbiaException("No existe la clase $dbclass, necesaria para iniciar el adaptador");
        }

        return new $dbclass($config);
    }

}<commit_msg>En el cambio para usar mysqli, en vez de MySql lib se dejo un bug. Ahora ya solucionado<commit_after><?php
/**
 * KumbiaPHP web & app Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://wiki.kumbiaphp.com/Licencia
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to <EMAIL> so we can send you a copy immediately.
 *
 * @category   Kumbia
 * @package    Db
 * @copyright  Copyright (c) 2005-2012 Kumbia Team (http://www.kumbiaphp.com)
 * @license    http://wiki.kumbiaphp.com/Licencia     New BSD License
 */
/**
 * @see DbBaseInterface
 */
require_once dirname(__FILE__) . '/db_base_interface.php';
/**
 * @see DbBase
 */
require_once dirname(__FILE__) . '/db_base.php';

/**
 * Clase que maneja el pool de conexiones
 *
 * @category   Kumbia
 * @package    Db
 */
class Db
{

    /**
     * Singleton de conexiones a base de datos
     *
     * @var array
     */
    protected static $_connections = array();

    /**
     * Devuelve la conexión, si no existe llama a Db::connect para crearla
     *
     * @param boolean $new nueva conexion //TODO mirar si es necesaria
     * @param string $database base de datos a donde conectar
     * @return db
     */
    public static function factory($database = null, $new = false)
    {

        //Cargo el mode para mi aplicacion
        if (!$database) {
            $database = Config::get('config.application.database');
        }
        //Si no es una conexion nueva y existe la conexion singleton
        if (isset(self::$_connections[$database])) {
            return self::$_connections[$database];
        }

        return self::$_connections[$database] = self::connect($database);
    }

    /**
     * Realiza una conexión directa al motor de base de datos
     * usando el driver de Kumbia
     *
     * @param string $database base de datos a donde conectar
     * @return db
     */
    private static function connect($database)
    {
        $databases = Config::read('databases');
        $config = $databases[$database];

        // carga los valores por defecto para la conexión, si no existen
        $default = array('port' => 0, 'dsn' => NULL, 'dbname' => NULL, 'host' => 'localhost', 'username' => NULL, 'password' => NULL);
        $config = $config + $default;
        $path = dirname(__FILE__); 

        //Si usa PDO
        if (isset($config['pdo'])) {
            $dbclass = "DbPdo{$config['type']}";
            $db_file = "$path/adapters/pdo/{$config['type']}.php";
        } else {
            if($config['type'] == 'mysql') $config['type'] = 'mysqli';
            $dbclass = "Db{$config['type']}";
            $db_file = "$path/adapters/{$config['type']}.php";
        }

        //Carga la clase adaptadora necesaria
        if (!include_once $db_file) {
            throw new KumbiaException("No existe la clase $dbclass, necesaria para iniciar el adaptador");
        }

        return new $dbclass($config);
    }

}
{'fraction_non_alphanumeric': 0.12859206935302617, 'fraction_numerical': 0.0028897094236635095, 'mean_word_length': 2.474623535973229, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 18, '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': '5068003', 'n_tokens_mistral': 1953, 'n_tokens_neox': 1888, 'n_words': 603}