diff --git a/ChangeLog b/ChangeLog index b4306c650..05834b0ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ $HeadURL$ 2.10.3.0 (not yet released) - bug #1734285 Copy database with VIEWs +- bug #1722502 DROP TABLE in export VIEW 2.10.2.0 (not yet released) diff --git a/libraries/config.default.php b/libraries/config.default.php index cb9ba6af2..70d14ebd9 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -327,7 +327,7 @@ $cfg['Export']['sql_disable_fk'] = FALSE; $cfg['Export']['sql_use_transaction'] = FALSE; $cfg['Export']['sql_drop_database'] = FALSE; $cfg['Export']['sql_drop_table'] = FALSE; -$cfg['Export']['sql_if_not_exists'] = FALSE; +$cfg['Export']['sql_if_not_exists'] = TRUE; $cfg['Export']['sql_procedure_function'] = FALSE; $cfg['Export']['sql_auto_increment'] = TRUE; $cfg['Export']['sql_backquotes'] = TRUE; diff --git a/libraries/export/sql.php b/libraries/export/sql.php index 557bc60a4..ce29aba60 100644 --- a/libraries/export/sql.php +++ b/libraries/export/sql.php @@ -366,7 +366,11 @@ function PMA_exportDBFooter($db) * @access public */ function PMA_getTableDefStandIn($db, $view, $crlf) { - $create_query = 'CREATE TABLE ' . PMA_backquote($view) . ' (' . $crlf; + $create_query = 'CREATE TABLE '; + if (isset($GLOBALS['sql_if_not_exists']) && $GLOBALS['sql_if_not_exists']) { + $create_query .= 'IF NOT EXISTS '; + } + $create_query .= PMA_backquote($view) . ' (' . $crlf; $tmp = array(); $columns = PMA_DBI_get_columns_full($db, $view); foreach($columns as $column_name => $definition) {