Documentation TYPO3 par Ameos

db_table_exists.lib.php

00001 <?php
00002 /* $Id: db_table_exists.lib.php,v 2.8 2004/10/19 19:51:54 nijel Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00009 if (!isset($is_db) || !$is_db) {
00010     // Not a valid db name -> back to the welcome page
00011     if (!empty($db)) {
00012         $is_db = @PMA_DBI_select_db($db);
00013     }
00014     if (empty($db) || !$is_db) {
00015         if (!isset($is_transformation_wrapper)) {
00016             PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
00017         }
00018         exit;
00019     }
00020 } // end if (ensures db exists)
00021 if (!isset($is_table) || !$is_table) {
00022     // Not a valid table name -> back to the db_details.php
00023     if (!empty($table)) {
00024         $is_table = PMA_DBI_try_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', NULL, PMA_DBI_QUERY_STORE);
00025     }
00026     if (empty($table)
00027         || !($is_table && @PMA_DBI_num_rows($is_table))) {
00028         $redirect = TRUE;
00029         if (!isset($is_transformation_wrapper)) {
00030             $redirect = TRUE;
00031             if (!empty($table)) {
00032                 PMA_DBI_free_result($is_table);
00033                 // SHOW TABLES doesn't show temporary tables, so try select (as it can happen just in case temporary table, it should be fast):
00034                 $is_table2 = PMA_DBI_try_query('SELECT COUNT(*) FROM `' . PMA_sqlAddslashes($table, TRUE) . '`;', NULL, PMA_DBI_QUERY_STORE);
00035                 $redirect = !($is_table2 && @PMA_DBI_num_rows($is_table2));
00036                 PMA_DBI_free_result($is_table2);
00037             }
00038 
00039             if ($redirect) {
00040                 PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'db_details.php?' . PMA_generate_common_url($db, '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
00041             }
00042         }
00043         if ($redirect) exit;
00044     } else if (isset($is_table)) {
00045         PMA_DBI_free_result($is_table);
00046     }
00047 } // end if (ensures table exists)
00048 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6