2.5.2 maybe
[phpmyadmin/crack.git] / db_details_db_info.php3
blobbc0e76bdc86c210357cf8742b6ef6e1d1f89df97
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 $tables = array();
11 if (PMA_MYSQL_INT_VERSION >= 32303) {
12 // Special speedup for newer MySQL Versions (in 4.0 format changed)
13 if ($cfg['SkipLockedTables'] == TRUE && PMA_MYSQL_INT_VERSION >= 32330) {
14 $local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db);
15 $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
16 // Blending out tables in use
17 if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
18 while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
19 // if in use memorize tablename
20 if (eregi('in_use=[1-9]+', $tmp[1])) {
21 $sot_cache[$tmp[0]] = TRUE;
24 mysql_free_result($db_info_result);
26 if (isset($sot_cache)) {
27 $local_query = 'SHOW TABLES FROM ' . PMA_backquote($db);
28 $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
29 if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
30 while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
31 if (!isset($sot_cache[$tmp[0]])) {
32 $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'';
33 $sts_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
34 $sts_tmp = PMA_mysql_fetch_array($sts_result);
35 $tables[] = $sts_tmp;
36 } else { // table in use
37 $tables[] = array('Name' => $tmp[0]);
40 mysql_free_result($db_info_result);
41 $sot_ready = TRUE;
46 if (!isset($sot_ready)) {
47 $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
48 $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
49 if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
50 while ($sts_tmp = PMA_mysql_fetch_array($db_info_result)) {
51 $tables[] = $sts_tmp;
53 mysql_free_result($db_info_result);
56 $num_tables = (isset($tables) ? count($tables) : 0);
57 } // end if (PMA_MYSQL_INT_VERSION >= 32303)
58 else {
59 $db_info_result = PMA_mysql_list_tables($db);
60 $num_tables = ($db_info_result) ? @mysql_numrows($db_info_result) : 0;
61 for ($i = 0; $i < $num_tables; $i++) {
62 $tables[] = PMA_mysql_tablename($db_info_result, $i);
64 mysql_free_result($db_info_result);
68 /**
69 * Displays top menu links
71 echo '<!-- Top menu links -->' . "\n";
72 require('./db_details_links.php3');