forked from phpmyadmin/phpmyadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
db_details_db_info.php3
84 lines (74 loc) · 3.22 KB
/
db_details_db_info.php3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4:
// Check parameters
if (!defined('PMA_COMMON_LIB_INCLUDED')) {
include('./libraries/common.lib.php3');
}
PMA_checkParameters(array('db'));
/**
* Gets the list of the table in the current db and informations about these
* tables if possible
*/
// staybyte: speedup view on locked tables - 11 June 2001
$tables = array();
if (PMA_MYSQL_INT_VERSION >= 32303) {
// Special speedup for newer MySQL Versions (in 4.0 format changed)
if ($cfg['SkipLockedTables'] == TRUE && PMA_MYSQL_INT_VERSION >= 32330) {
$local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db);
$db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
// Blending out tables in use
if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
// if in use memorize tablename
if (eregi('in_use=[1-9]+', $tmp[1])) {
$sot_cache[$tmp[0]] = TRUE;
}
}
mysql_free_result($db_info_result);
if (isset($sot_cache)) {
$local_query = 'SHOW TABLES FROM ' . PMA_backquote($db);
$db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
if (!isset($sot_cache[$tmp[0]])) {
$local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'';
$sts_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
$sts_tmp = PMA_mysql_fetch_array($sts_result);
$tables[] = $sts_tmp;
} else { // table in use
$tables[] = array('Name' => $tmp[0]);
}
}
mysql_free_result($db_info_result);
$sot_ready = TRUE;
}
}
}
}
if (!isset($sot_ready)) {
$local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
$db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
while ($sts_tmp = PMA_mysql_fetch_array($db_info_result)) {
$tables[] = $sts_tmp;
}
mysql_free_result($db_info_result);
}
}
$num_tables = (isset($tables) ? count($tables) : 0);
} // end if (PMA_MYSQL_INT_VERSION >= 32303)
else {
$db_info_result = PMA_mysql_list_tables($db);
$num_tables = ($db_info_result) ? @mysql_numrows($db_info_result) : 0;
for ($i = 0; $i < $num_tables; $i++) {
$tables[] = PMA_mysql_tablename($db_info_result, $i);
}
mysql_free_result($db_info_result);
}
/**
* Displays top menu links
*/
echo '<!-- Top menu links -->' . "\n";
require('./db_details_links.php3');
?>