diff --git a/ChangeLog b/ChangeLog index ee466b068..19fe18f51 100755 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,9 @@ $Source$ name or not at the top of the page. * tbl_select.php3: the script to returns to was hard coded, now it's the one that calls tbl_select.php3. + * tbl_copy.php3; tbl_properties.php3: re-enabled the ability to copy a + table to another database (bug #456434). Need to be tested with + MySQL < 3.23 releases. 2001-08-28 Loïc Chapeaux * lang/galician.inc.php3, select_lang.inc.php3: new Galician lang thanks to diff --git a/tbl_copy.php3 b/tbl_copy.php3 index c421855b9..360c58095 100755 --- a/tbl_copy.php3 +++ b/tbl_copy.php3 @@ -9,15 +9,15 @@ * * @global string the database name * @global string the original table name - * @global string the target table name + * @global string the target database and table names * @global string the sql query used to copy the data */ function my_handler($sql_insert = '') { - global $db, $table, $new_name; + global $db, $table, $target; global $sql_insert_data; - $sql_insert = eregi_replace('INSERT INTO (`?)' . $table . '(`?)', 'INSERT INTO ' . backquote($new_name), $sql_insert); + $sql_insert = eregi_replace('INSERT INTO (`?)' . $table . '(`?)', 'INSERT INTO ' . $target, $sql_insert); $result = mysql_query($sql_insert) or mysql_die('', $sql_insert); $sql_insert_data .= $sql_insert . ';' . "\n"; @@ -44,8 +44,19 @@ if (isset($new_name) && trim($new_name) != '') { $use_backquotes = 1; $asfile = 1; + if (get_magic_quotes_gpc()) { + if (!empty($target_db)) { + $target_db = stripslashes($target_db); + } else { + $target_db = stripslashes($db); + } + $new_name = stripslashes($new_name); + } + $source = backquote($db) . '.' . backquote($table); + $target = backquote($target_db) . '.' . backquote($new_name); + $sql_structure = get_table_def($db, $table, "\n"); - $sql_structure = eregi_replace('^CREATE TABLE (`?)' . $table . '(`?)', 'CREATE TABLE ' . backquote($new_name), $sql_structure); + $sql_structure = eregi_replace('^CREATE TABLE (`?)' . $table . '(`?)', 'CREATE TABLE ' . $target, $sql_structure); $result = mysql_query($sql_structure) or mysql_die('', $sql_structure); if (isset($sql_query)) { $sql_query .= "\n" . $sql_structure . ';'; @@ -57,7 +68,7 @@ if (isset($new_name) && trim($new_name) != '') { if ($result != FALSE && $what == 'data') { // speedup copy table - staybyte - 22. Juni 2001 if (MYSQL_INT_VERSION >= 32300) { - $sql_insert_data = 'INSERT INTO ' . backquote($new_name) . ' SELECT * FROM ' . backquote($table); + $sql_insert_data = 'INSERT INTO ' . $target . ' SELECT * FROM ' . backquote($table); $result = mysql_query($sql_insert_data) or mysql_die('', $sql_insert_data); } // end MySQL >= 3.23 else { @@ -67,7 +78,7 @@ if (isset($new_name) && trim($new_name) != '') { $sql_query .= "\n\n" . $sql_insert_data; } - $message = sprintf($strCopyTableOK, $table, $new_name); + $message = sprintf($strCopyTableOK, $source, $target); $reload = 'true'; } // end is target table name diff --git a/tbl_properties.php3 b/tbl_properties.php3 index 3b46e45cb..fcf6f8b7e 100755 --- a/tbl_properties.php3 +++ b/tbl_properties.php3 @@ -808,12 +808,14 @@ echo "\n";
-  : + .' . trim($strTable) . ')'; ?> :
- + +  .  +