protected function connect() {
        $db = Config::config()['user']['database'];

        if ($db['enabled']) {
            switch ($db['driver']) {
                case 'pdo' :
                    $options = [Pdo::ATTR_STATEMENT_CLASS => ['\Gcs\Framework\Core\Pdo\PdoStatement', []]];

                    switch ($db['type']) {
                        case 'mysql':
                            try {
                                $this->db = new Pdo('mysql:host=' . $db['hostname'] . ';dbname=' . $db['database'], $db['username'], $db['password'], $options);
                                //self::$sql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                                $this->db->exec('SET NAMES ' . strtoupper($db['charset']));
                            }
                            catch (\PDOException $e) {
                                throw new MissingDatabaseException($e->getMessage() . ' / ' . $e->getCode() . ' / ' . $e->getFile());
                            }
                            break;

                        case 'pgsql':
                            try {
                                $this->db = new Pdo('mysql:host=' . $db['hostname'] . ';dbname=' . $db['database'], $db['username'], $db['password'], $options);
                                //self::$sql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                                $this->db->exec('SET NAMES ' . strtoupper($db['charset']));
                            }
                            catch (\PDOException $e) {
                                throw new MissingDatabaseException($e->getMessage() . ' / ' . $e->getCode());
                            }
                            break;

                        default :
                            throw new MissingDatabaseException("Can't connect to SQL Database because the driver is not supported");
                            break;
                    }
                    break;

                default :
                    throw new MissingDatabaseException("Can't connect to SQL Database because the API is unrecognized");
                    break;
            }

            return $this->db;
        }
        else {
            return null;
        }
    }