From: Ken Youens-Clark Date: Tue, 14 Apr 2009 16:54:36 +0000 (+0000) Subject: Added patch from user. X-Git-Tag: v0.11008~214 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e6642bff4ab915e171db8a00b5207e69d85a9d9a;p=dbsrgits%2FSQL-Translator.git Added patch from user. --- diff --git a/lib/SQL/Translator/Parser/MySQL.pm b/lib/SQL/Translator/Parser/MySQL.pm index c9cf42c..c4d5aec 100644 --- a/lib/SQL/Translator/Parser/MySQL.pm +++ b/lib/SQL/Translator/Parser/MySQL.pm @@ -343,11 +343,16 @@ create : CREATE PROCEDURE NAME not_delimiter "$delimiter" PROCEDURE : /procedure/i | /function/i -create : CREATE algorithm /view/i NAME not_delimiter "$delimiter" +create : CREATE algorithm(?) /view/i NAME not_delimiter "$delimiter" { @table_comments = (); my $view_name = $item[4]; - my $sql = "$item[1] $item[2] $item[3] $item[4] $item[5]"; + my $sql; + if (scalar(@{$item[2]}) == 1) { + $sql = "$item[1] $item[2][0] $item[3] $item[4] $item[5]"; + } else { + $sql = "$item[1] $item[3] $item[4] $item[5]"; + } # Hack to strip database from function calls in SQL $sql =~ s#`\w+`\.(`\w+`\()##g;