public function executeSQL(string $filename)
    {
        $fh = @fopen($filename, "r");
        if ($fh === false)
            throw new IOException("Unable to open file '$filename'");

        $prefix = $this->driver->getTablePrefix();
        
        $statement = '';
        while (!feof($fh))
        {
            $line = fgets($fh);
            $trimmed = trim($line);

            // Skip comments
            if (substr($trimmed, 0, 2) === '--')
                continue;

            if ($line)
                $statement .= "\n" . $line;

            if (substr($trimmed, -1) === ';')
            {
                $statement = trim(str_replace('%PREFIX%', $prefix, $statement));
                $this->exec($statement);
                $statement = '';
            }
        }
        fclose($fh);
        return $this;
    }