diff --git a/ChangeLog b/ChangeLog index 46a4195c7..fae5f3346 100755 --- a/ChangeLog +++ b/ChangeLog @@ -35,6 +35,8 @@ $Source$ * libraries/zip.lib.php: Drop unneed part of header which causes troubles to some programs (bug #1037737). * index.php: Add frame spacing (RFE #1036013). + * libraries/db_table_exists.lib.php: Allow work on temporary tables (bug + #864984). 2004-10-17 Marc Delisle * lang/turkish update, thanks to boralioglu. diff --git a/libraries/db_table_exists.lib.php b/libraries/db_table_exists.lib.php index b8d0dbc8e..8c0d53e55 100644 --- a/libraries/db_table_exists.lib.php +++ b/libraries/db_table_exists.lib.php @@ -25,10 +25,22 @@ if (!isset($is_table) || !$is_table) { } if (empty($table) || !($is_table && @PMA_DBI_num_rows($is_table))) { + $redirect = TRUE; if (!isset($is_transformation_wrapper)) { - PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'db_details.php?' . PMA_generate_common_url($db, '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); + $redirect = TRUE; + if (!empty($table)) { + PMA_DBI_free_result($is_table); + // SHOW TABLES doesn't show temporary tables, so try select (as it can happen just in case temporary table, it should be fast): + $is_table2 = PMA_DBI_try_query('SELECT COUNT(*) FROM `' . PMA_sqlAddslashes($table, TRUE) . '`;', NULL, PMA_DBI_QUERY_STORE); + $redirect = !($is_table2 && @PMA_DBI_num_rows($is_table2)); + PMA_DBI_free_result($is_table2); + } + + if ($redirect) { + PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'db_details.php?' . PMA_generate_common_url($db, '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); + } } - exit; + if ($redirect) exit; } else if (isset($is_table)) { PMA_DBI_free_result($is_table); }