bug 696215
[phpmyadmin/crack.git] / db_details_db_info.php3
blob5e303cbbee8f73b6bf73abb95279ae2a48ef52e4
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 /**
6 * Gets the list of the table in the current db and informations about these
7 * tables if possible
8 */
9 // staybyte: speedup view on locked tables - 11 June 2001
10 if (PMA_MYSQL_INT_VERSION >= 32303) {
11 // Special speedup for newer MySQL Versions (in 4.0 format changed)
12 if ($cfg['SkipLockedTables'] == TRUE && PMA_MYSQL_INT_VERSION >= 32330) {
13 $local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db);
14 $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
15 // Blending out tables in use
16 if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
17 while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
18 // if in use memorize tablename
19 if (eregi('in_use=[1-9]+', $tmp[1])) {
20 $sot_cache[$tmp[0]] = TRUE;
23 mysql_free_result($db_info_result);
25 if (isset($sot_cache)) {
26 $local_query = 'SHOW TABLES FROM ' . PMA_backquote($db);
27 $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
28 if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
29 while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
30 if (!isset($sot_cache[$tmp[0]])) {
31 $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'';
32 $sts_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
33 $sts_tmp = PMA_mysql_fetch_array($sts_result);
34 $tables[] = $sts_tmp;
35 } else { // table in use
36 $tables[] = array('Name' => $tmp[0]);
39 mysql_free_result($db_info_result);
40 $sot_ready = TRUE;
45 if (!isset($sot_ready)) {
46 $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
47 $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
48 if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
49 while ($sts_tmp = PMA_mysql_fetch_array($db_info_result)) {
50 $tables[] = $sts_tmp;
52 mysql_free_result($db_info_result);
55 $num_tables = (isset($tables) ? count($tables) : 0);
56 } // end if (PMA_MYSQL_INT_VERSION >= 32303)
57 else {
58 $db_info_result = PMA_mysql_list_tables($db);
59 $num_tables = ($db_info_result) ? @mysql_numrows($db_info_result) : 0;
60 for ($i = 0; $i < $num_tables; $i++) {
61 $tables[] = PMA_mysql_tablename($db_info_result, $i);
63 mysql_free_result($db_info_result);
67 /**
68 * Displays top menu links
70 echo '<!-- Top menu links -->' . "\n";
71 require('./db_details_links.php3');