diff --git a/ChangeLog b/ChangeLog index b3574e77f..50cf3d936 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2001-06-27 Marc Delisle + * bug 434608: support db names with special characters (MySQL >= 3.23.6) + + 2001-06-27 Steve Alberty * lib.inc.php3: speedup get_table_content for tbl_dump * tbl_dump: fixed a big bug diff --git a/db_create.php3 b/db_create.php3 index 6fd225891..a267d9fa6 100755 --- a/db_create.php3 +++ b/db_create.php3 @@ -6,9 +6,9 @@ require("./grab_globals.inc.php3"); require("./header.inc.php3"); -$result = mysql_query("CREATE DATABASE $db") or mysql_die(); +$result = mysql_query("CREATE DATABASE " . db_name($db)) or mysql_die(); -$message = "$strDatabase $db $strHasBeenCreated"; +$message = "$strDatabase " . db_name($db) . " $strHasBeenCreated"; require("./db_details.php3"); ?> diff --git a/db_details.php3 b/db_details.php3 index d1f108be2..163b3be0e 100755 --- a/db_details.php3 +++ b/db_details.php3 @@ -19,7 +19,7 @@ $num_tables = @mysql_numrows($tables); if ($num_tables>0 && MYSQL_MAJOR_VERSION>=3.23 && intval(MYSQL_MINOR_VERSION)>=3){ // Special speedup for newer MySQL Versions if ($cfgSkipLockedTables==true && MYSQL_MAJOR_VERSION==3.23 && intval(MYSQL_MINOR_VERSION)>=30){ // in 4.0 format changed - $query="SHOW OPEN TABLES from $db"; + $query="SHOW OPEN TABLES from " . db_name($db); $result=mysql_query($query); // Blending out tables in use if ($result!=false && mysql_num_rows($result)>0){ @@ -32,12 +32,12 @@ if ($num_tables>0 && MYSQL_MAJOR_VERSION>=3.23 && intval(MYSQL_MINOR_VERSION)>=3 mysql_free_result($result); if (isset($sot_cache)){ - $query="show tables from $db"; + $query="show tables from " . db_name($db); $result=mysql_query($query); if ($result!=false && mysql_num_rows($result)>0){ while ($tmp=mysql_fetch_array($result)){ if (!isset($sot_cache[$tmp[0]])){ - $sts_result=mysql_query("show table status from $db like '".AddSlashes($tmp[0])."'"); + $sts_result=mysql_query("show table status from " . db_name($db) . " like '".AddSlashes($tmp[0])."'"); $sts_tmp=mysql_fetch_array($sts_result); $tbl_cache[]=$sts_tmp; } @@ -53,7 +53,7 @@ if ($num_tables>0 && MYSQL_MAJOR_VERSION>=3.23 && intval(MYSQL_MINOR_VERSION)>=3 } } if (!isset($sot_ready)){ - $result=mysql_query("show table status from $db"); + $result=mysql_query("show table status from " .db_name($db)); if ($result!=false && mysql_num_rows($result)>0){ while ($sts_tmp=mysql_fetch_array($result)){ $tbl_cache[]=$sts_tmp; @@ -269,7 +269,7 @@ if($cfgBookmark['db'] && $cfgBookmark['table'])
  • -&zero_rows=&goto=main.php3&reload=true"> +&zero_rows=&goto=main.php3&reload=true"> 20){ - $result=mysql_query("show create table $db.$table"); + $result=mysql_query("show create table " .db_name($db).".$table"); if ($result!=false && mysql_num_rows($result)>0){ $tmpres=mysql_fetch_array($result); $tmp=$tmpres[1]; @@ -497,7 +497,7 @@ function get_table_def($db, $table, $crlf) $schema_create .= "CREATE TABLE $table ($crlf"; - $result = mysql_query("SHOW FIELDS FROM $db.$table") or mysql_die(); + $result = mysql_query("SHOW FIELDS FROM " .db_name($db).".$table") or mysql_die(); while($row = mysql_fetch_array($result)) { $schema_create .= " $row[Field] $row[Type]"; @@ -511,7 +511,7 @@ function get_table_def($db, $table, $crlf) $schema_create .= ",$crlf"; } $schema_create = ereg_replace(",".$crlf."$", "", $schema_create); - $result = mysql_query("SHOW KEYS FROM $db.$table") or mysql_die(); + $result = mysql_query("SHOW KEYS FROM " .db_name($db).".$table") or mysql_die(); while($row = mysql_fetch_array($result)) { $kname=$row['Key_name']; @@ -567,7 +567,7 @@ function get_table_content ($db, $table, $handler){ // only php > 4.0.5 - staybyte - 27. June 2001 function get_table_content_fast($db, $table, $handler){ - $result = mysql_query("SELECT * FROM $db.$table") or mysql_die(); + $result = mysql_query("SELECT * FROM ".db_name($db).".$table") or mysql_die(); if ($result!=false){ for($j=0; $j= "3.23" + && intval(MYSQL_MINOR_VERSION) >= 6) { + return "`" . $db . "`"; + } + else return $db; +} + include ("./defines.inc.php3"); } // $__LIB_INC__ diff --git a/tbl_addfield.php3 b/tbl_addfield.php3 index 005d0669e..3024dfeb0 100755 --- a/tbl_addfield.php3 +++ b/tbl_addfield.php3 @@ -63,7 +63,7 @@ if(isset($submit)) } $sql_query = "ALTER TABLE $table ADD $query"; - $result = mysql_query("ALTER TABLE $db.$table ADD $query"); + $result = mysql_query("ALTER TABLE ".db_name($db).".$table ADD $query"); $primary = ''; @@ -80,7 +80,7 @@ if(isset($submit)) { $primary = "ADD PRIMARY KEY ($primary)"; $sql_query .= "\nALTER TABLE $table $primary"; - $result = mysql_query("ALTER TABLE $db.$table $primary") or mysql_die(); + $result = mysql_query("ALTER TABLE ".db_name($db).".$table $primary") or mysql_die(); } } @@ -101,7 +101,7 @@ if(isset($submit)) { $index = "ADD INDEX ($index)"; $sql_query .= "\nALTER TABLE $table $index"; - $result = mysql_query("ALTER TABLE $db.$table $index") or mysql_die(); + $result = mysql_query("ALTER TABLE ".db_name($db).".$table $index") or mysql_die(); } } @@ -122,7 +122,7 @@ if(isset($submit)) { $unique = "ADD UNIQUE ($unique)"; $sql_query .= "\nALTER TABLE $table $unique"; - $result = mysql_query("ALTER TABLE $db.$table $unique") or mysql_die(); + $result = mysql_query("ALTER TABLE ".db_name($db).".$table $unique") or mysql_die(); } } diff --git a/tbl_alter.php3 b/tbl_alter.php3 index 8bf72a8cc..9ef0f3b36 100755 --- a/tbl_alter.php3 +++ b/tbl_alter.php3 @@ -23,7 +23,7 @@ if(isset($submit)) $query = stripslashes($query); } //optimization fix - 2 May 2001 - Robbat2 - $sql_query = "ALTER TABLE $db.$table CHANGE $query"; + $sql_query = "ALTER TABLE ".db_name($db).".$table CHANGE $query"; $result = mysql_query($sql_query) or mysql_die(); $message = "$strTable $table $strHasBeenAltered"; include("./tbl_properties.php3"); @@ -31,7 +31,7 @@ if(isset($submit)) } else { - $result = mysql_query("SHOW FIELDS FROM $db.$table LIKE '$field'") or mysql_die(); + $result = mysql_query("SHOW FIELDS FROM ".db_name($db).".$table LIKE '$field'") or mysql_die(); $num_fields = mysql_num_rows($result); $action = "tbl_alter.php3"; include("./tbl_properties.inc.php3");