From 0bca319d18164b04d1e1e739c5857746f198c03c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 18 Oct 2006 14:39:49 +0000 Subject: [PATCH] Keep 0 in exported auto_increment fields (bug #1440544). --- ChangeLog | 2 ++ libraries/export/sql.php | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b77215071..3bfdbcd46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,8 @@ $HeadURL$ themes/original/css/theme_right.css.php, libraries/sql_query_form.lib.php: Let's again obey TextareaRows (bug #1465906). + * libraries/export/sql.php: Keep 0 in exported auto_increment fields (bug + #1440544). 2006-10-17 Marc Delisle * export.php: export nothing if no tables are selected diff --git a/libraries/export/sql.php b/libraries/export/sql.php index e3c727bba..9cd79644a 100644 --- a/libraries/export/sql.php +++ b/libraries/export/sql.php @@ -203,10 +203,17 @@ function PMA_exportHeader() $head .= $crlf . 'SET FOREIGN_KEY_CHECKS=0;' . $crlf; } + /* We want exported AUTO_INCREMENT fields to have still same value, do this only for recent MySQL exports */ + if (!isset($GLOBALS['sql_compatibility']) || $GLOBALS['sql_compatibility'] == 'NONE') { + $head .= $crlf . 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";' . $crlf; + } + if (isset($GLOBALS['sql_use_transaction'])) { $head .= $crlf .'SET AUTOCOMMIT=0;' . $crlf - . 'START TRANSACTION;' . $crlf . $crlf; + . 'START TRANSACTION;' . $crlf; } + + $head .= $crlf; return PMA_exportOutputHandler($head); }