1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-16 11:34:10 +02:00
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@729 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-06-21 23:20:32 +00:00
parent 5d311ef2d9
commit 64ba92421b
29 changed files with 153 additions and 93 deletions

View File

@@ -3,6 +3,7 @@ page_header(lang('Database schema'), "", array(), $_GET["db"]);
$table_pos = array();
$table_pos_js = array();
// saved in one cookie because there is a limit of 20 cookies per domain
preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~', $_COOKIE["schema"], $matches, PREG_SET_ORDER); //! ':' in table name
foreach ($matches as $i => $match) {
$table_pos[$match[1]] = array($match[2], $match[3]);
@@ -11,9 +12,9 @@ foreach ($matches as $i => $match) {
$top = 0;
$base_left = -1;
$schema = array();
$referenced = array();
$lefts = array();
$schema = array(); // table => array("fields" => array(name => field), "pos" => array(top, left), "references" => array(table => array(left => array(source, target))))
$referenced = array(); // target_table => array(table => array(left => target_column))
$lefts = array(); // float => bool
$result = $dbh->query("SHOW TABLE STATUS");
while ($row = $result->fetch_assoc()) {
if (!isset($row["Engine"])) { // view
@@ -37,6 +38,7 @@ while ($row = $result->fetch_assoc()) {
$base_left -= .1;
}
while ($lefts[(string) $left]) {
// find free $left
$left -= .0001;
}
$schema[$row["Name"]]["references"][$val["table"]][(string) $left] = array($val["source"], $val["target"]);