static public function install($options, $sql, $adapterNamespace)
    {
        $adapterNamespace = !empty($adapterNamespace) ? $adapterNamespace : self::$adapterNamespace;
        $options['adapter']   = preg_replace('/[^A-Z0-9_\.-]/i', '', $options['adapter']);
        $class = self::$adapterNamespace . ucfirst(strtolower($options['adapter'])) . 'Adapter';
        
        if (!class_exists($class)) {
            throw new DbException('The database adapter ' . $class . ' is not valid.');
        }
        // If Sqlite
        if ( strtolower($options['adapter']) == 'sqlite' || strtolower($options['adapter']) == 'pdo') {
            if (!file_exists($options['database'])) {
                touch($options['database']);
                chmod($options['database'], 0777);
            }
            if (!file_exists($options['database'])) {
                throw new DbException('Could not create the database file.');
            }
        }
        
        $conn  = new $class($options);
        $lines = file($sql);
        
        // Remove comments, execute queries
        if (count($lines) > 0) {
            $insideComment = false;
            foreach ($lines as $i => $line) {
                if ($insideComment) {
                    if (substr($line, 0, 2) == '*/') {
                        $insideComment = false;
                    }
                    unset($lines[$i]);
                } else {
                    if ((substr($line, 0, 1) == '-') || (substr($line, 0, 1) == '#')) {
                        unset($lines[$i]);
                    } else if (substr($line, 0, 2) == '/*') {
                        $insideComment = true;
                        unset($lines[$i]);
                    }
                }
            }
            
            $sqlString  = trim(implode('', $lines));
            $newLine    = (strpos($sqlString, ";\r\n") !== false) ? ";\r\n" : ";\n";
            $statements = explode($newLine, $sqlString);
            
            foreach ($statements as $statement) {
                if (!empty($statement)) {
                    if (isset($options['table_prefix'])) {
                        $statement = str_replace('[{table_prefix}]', $options['table_prefix'], trim($statement));
                    }
                    $conn->query($statement);
                }
            }
        }
    }