From b59ac08abbabe8518fcc2ee82e3edc4d30c2b535 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 16 Nov 2002 10:57:10 +0000 Subject: [PATCH] for older MySQL --- ChangeLog | 4 ++++ libraries/build_dump.lib.php3 | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f7cf0f612..5fa22266b 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2002-11-16 Marc Delisle + * libraries/build_dump.lib.php3: fix for old MySQL, thanks to + Flavio Poletti (flavio at polettix.it) + 2002-11-08 Robin Johnson * lib/sqlparser.data.php3: Bug #639291 fixed diff --git a/libraries/build_dump.lib.php3 b/libraries/build_dump.lib.php3 index f78a6e5c7..0bab487be 100644 --- a/libraries/build_dump.lib.php3 +++ b/libraries/build_dump.lib.php3 @@ -71,6 +71,22 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ // Fix for case problems with winwin, thanks to // Paweł Szczepański $pos = strpos($tmpres[1], ' ('); + + // Fix a problem with older versions of mysql + // Find the first opening parenthesys, i.e. that after the name + // of the table + $pos2 = strpos($tmpres[1], '('); + // Old mysql did not insert a space after table name + // in query "show create table ..."! + if ($pos2 != $pos + 1) + { + // This is the real position of the first character after + // the name of the table + $pos = $pos2; + // Old mysql did not even put newlines and indentation... + $tmpres[1] = str_replace(",", ",\n ", $tmpres[1]); + } + $tmpres[1] = substr($tmpres[1], 0, 13) . (($use_backquotes) ? PMA_backquote($tmpres[0]) : $tmpres[0]) . substr($tmpres[1], $pos); @@ -78,7 +94,7 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ } mysql_free_result($result); return $schema_create; - } // end if MySQL >= 3.23.20 + } // end if MySQL >= 3.23.21 // For MySQL < 3.23.20 $schema_create .= 'CREATE TABLE ' . PMA_htmlFormat(PMA_backquote($table), $use_backquotes) . ' (' . $crlf;