bug 434608

This commit is contained in:
Marc Delisle
2001-06-26 15:33:29 +00:00
parent a8c08ae266
commit 166985ee2e
4 changed files with 17 additions and 13 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2001-06-26 Marc Delisle <lem9@users.sourceforge.net>
* bug 434608, dashes in db name: db_create.php3, lib.inc.php3,
db_details.php3
2001-06-26 Steve Alberty <alberty@neptunlabs.de>
* lib.inc.php3: add 3 new Constants:
PHPMYADMIN_VERSION, PHP_WINDOWS, PHP_INT_VERSION

View File

@@ -6,7 +6,7 @@ require("./grab_globals.inc.php3");
require("./header.inc.php3");
$result = mysql_query("CREATE DATABASE $db") or mysql_die();
$result = mysql_query("CREATE DATABASE `$db`") or mysql_die();
$message = "$strDatabase $db $strHasBeenCreated";
require("./db_details.php3");

View File

@@ -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`";
$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`";
$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` 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`");
if ($result!=false && mysql_num_rows($result)>0){
while ($sts_tmp=mysql_fetch_array($result)){
$tbl_cache[]=$sts_tmp;
@@ -270,7 +270,7 @@ if($cfgBookmark['db'] && $cfgBookmark['table'])
</form>
<li>
<a href="sql.php3?server=<?php echo $server;?>&lang=<?php echo $lang;?>&db=<?php echo $db;?>&sql_query=<?php echo urlencode("DROP DATABASE $db");?>&zero_rows=<?php echo urlencode($strDatabase." ".$db." ".$strHasBeenDropped);?>&goto=main.php3&reload=true"><?php echo $strDropDB." ".$db;?></a> <?php print show_docu("manual_Reference.html#DROP_DATABASE");?>
<a href="sql.php3?server=<?php echo $server;?>&lang=<?php echo $lang;?>&db=<?php echo $db;?>&sql_query=<?php echo urlencode("DROP DATABASE `$db`");?>&zero_rows=<?php echo urlencode($strDatabase." ".$db." ".$strHasBeenDropped);?>&goto=main.php3&reload=true"><?php echo $strDropDB." ".$db;?></a> <?php print show_docu("manual_Reference.html#DROP_DATABASE");?>
</ul>
</div>
<?php

View File

@@ -330,7 +330,7 @@ function display_table ($dt_result, $is_simple = false) {
$primary = false;
if(!$is_simple && !empty($table) && !empty($db)) {
$result = mysql_query("SELECT COUNT(*) as total FROM $db.$table") or mysql_die();
$result = mysql_query("SELECT COUNT(*) as total FROM `$db`.$table") or mysql_die();
$row = mysql_fetch_array($result);
$total = $row["total"];
}
@@ -513,7 +513,7 @@ function get_table_def($db, $table, $crlf)
// modified by Lem9 to allow older MySQL versions to continue to work
if(MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 20){
$result=mysql_query("show create table $db.$table");
$result=mysql_query("show create table `$db`.$table");
if ($result!=false && mysql_num_rows($result)>0){
$tmpres=mysql_fetch_array($result);
$tmp=$tmpres[1];
@@ -524,7 +524,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`.$table") or mysql_die();
while($row = mysql_fetch_array($result))
{
$schema_create .= " $row[Field] $row[Type]";
@@ -538,7 +538,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`.$table") or mysql_die();
while($row = mysql_fetch_array($result))
{
$kname=$row['Key_name'];
@@ -587,7 +587,7 @@ function get_table_def($db, $table, $crlf)
// $handler must accept one parameter ($sql_insert);
function get_table_content($db, $table, $handler)
{
$result = mysql_query("SELECT * FROM $db.$table") or mysql_die();
$result = mysql_query("SELECT * FROM `$db`.$table") or mysql_die();
$i = 0;
while($row = mysql_fetch_row($result))
{
@@ -643,7 +643,7 @@ function get_table_content($db, $table, $handler)
function count_records ($db,$table)
{
$result = mysql_query("select count(*) as num from $db.$table");
$result = mysql_query("select count(*) as num from `$db`.$table");
$num = mysql_result($result,0,"num");
echo $num;
}
@@ -654,7 +654,7 @@ function count_records ($db,$table)
// $handler must accept one parameter ($sql_insert);
function get_table_csv($db, $table, $sep, $handler)
{
$result = mysql_query("SELECT * FROM $db.$table") or mysql_die();
$result = mysql_query("SELECT * FROM `$db`.$table") or mysql_die();
$i = 0;
while($row = mysql_fetch_row($result))
{