From: Nicolas Boisselier Date: Fri, 9 Sep 2016 08:37:19 +0000 (+0200) Subject: view sql bug fix X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=e2908f68fcdd26ff387224afcf8b109253f3031c;p=nb.git view sql bug fix --- diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 2a3afd02..1a0d0ba6 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -147,7 +147,7 @@ Class Table extends nb { if ($from_sql) return $sql_replace($this->sql()); if ($this->type() == 'view') { - return $sql_replace('CREATE VIEW '.$this->sql_name().' AS SELECT'.preg_replace('/^CREATE\s+.*?\s+AS\s+.*?SELECT/i','',$this->sql())); + return $sql_replace('CREATE VIEW '.$this->sql_name().' AS '.preg_replace('/^CREATE\s+.*?\s+AS\s+.*?SELECT/i','SELECT',$this->sql())); } // Specific function for fields if return something use it instead of default