From 482d0de1dfd5ed877599c42ef34ed1a71019e653 Mon Sep 17 00:00:00 2001 From: Dirk-jan Date: Sat, 13 Jul 2013 11:30:29 +0200 Subject: [PATCH] Added SQL_MODE for copy and move operations to prevent import errors --- libraries/operations.lib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/operations.lib.php b/libraries/operations.lib.php index 3b275f6430..126c835306 100644 --- a/libraries/operations.lib.php +++ b/libraries/operations.lib.php @@ -377,6 +377,11 @@ function PMA_getSqlQueryAndCreateDbBeforeCopy() $GLOBALS['dbi']->query($local_query); $GLOBALS['db'] = $original_db; + // Set the SQL mode to NO_AUTO_VALUE_ON_ZERO to prevent MySQL from creating + // export statements it cannot import + $sql_set_mode = "SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO'"; + PMA_DBI_query($sql_set_mode); + // rebuild the database list because PMA_Table::moveCopy // checks in this list if the target db exists $GLOBALS['pma']->databases->build();