Aleksander Machniak
2016-03-26 e8b6e726f6e023a46e23c982ba7b3f76f0b657cb
program/lib/Roundcube/rcube_db_mssql.php
@@ -167,4 +167,24 @@
        return $result;
    }
    /**
     * Parse SQL file and fix table names according to table prefix
     */
    protected function fix_table_names($sql)
    {
        if (!$this->options['table_prefix']) {
            return $sql;
        }
        // replace sequence names, and other postgres-specific commands
        $sql = preg_replace_callback(
            '/((TABLE|(?<!ON )UPDATE|INSERT INTO|FROM(?! deleted)| ON(?! (DELETE|UPDATE|\[PRIMARY\]))'
            . '|REFERENCES|CONSTRAINT|TRIGGER|INDEX)\s+(\[dbo\]\.)?[\[\]]*)([^\[\]\( \r\n]+)/',
            array($this, 'fix_table_names_callback'),
            $sql
        );
        return $sql;
    }
}