Changed mysql function names in mysqli_*
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
function import() {
|
function import() {
|
||||||
$db = (isset($_GET["database"]) ? $_GET["database"] : "information_schema");
|
$db = (isset($_GET["database"]) ? $_GET["database"] : "information_schema");
|
||||||
$db = mysql_real_escape_string($db);
|
$mysqli = mysqli_connect(HOST,USER,PASS,DB);
|
||||||
|
$db = mysqli_real_escape_string($mysqli,$db);
|
||||||
$xml = "";
|
$xml = "";
|
||||||
|
|
||||||
$arr = array();
|
$arr = array();
|
||||||
@@ -12,16 +13,16 @@
|
|||||||
$arr[] = $datatypes[$i];
|
$arr[] = $datatypes[$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = mysql_query("SELECT * FROM TABLES WHERE TABLE_SCHEMA = '".$db."'");
|
$result = mysqli_query($mysqli,"SELECT * FROM TABLES WHERE TABLE_SCHEMA = '".$db."'");
|
||||||
while ($row = mysql_fetch_array($result)) {
|
while ($row = mysqli_fetch_array($result)) {
|
||||||
$table = $row["TABLE_NAME"];
|
$table = $row["TABLE_NAME"];
|
||||||
$xml .= '<table name="'.$table.'">';
|
$xml .= '<table name="'.$table.'">';
|
||||||
$comment = (isset($row["TABLE_COMMENT"]) ? $row["TABLE_COMMENT"] : "");
|
$comment = (isset($row["TABLE_COMMENT"]) ? $row["TABLE_COMMENT"] : "");
|
||||||
if ($comment) { $xml .= '<comment>'.$comment.'</comment>'; }
|
if ($comment) { $xml .= '<comment>'.$comment.'</comment>'; }
|
||||||
|
|
||||||
$q = "SELECT * FROM COLUMNS WHERE TABLE_NAME = '".$table."' AND TABLE_SCHEMA = '".$db."'";
|
$q = "SELECT * FROM COLUMNS WHERE TABLE_NAME = '".$table."' AND TABLE_SCHEMA = '".$db."'";
|
||||||
$result2 = mysql_query($q);
|
$result2 = mysqli_query($mysqli,$q);
|
||||||
while ($row = mysql_fetch_array($result2)) {
|
while ($row = mysqli_fetch_array($result2)) {
|
||||||
$name = $row["COLUMN_NAME"];
|
$name = $row["COLUMN_NAME"];
|
||||||
$type = $row["COLUMN_TYPE"];
|
$type = $row["COLUMN_TYPE"];
|
||||||
$comment = (isset($row["COLUMN_COMMENT"]) ? $row["COLUMN_COMMENT"] : "");
|
$comment = (isset($row["COLUMN_COMMENT"]) ? $row["COLUMN_COMMENT"] : "");
|
||||||
@@ -43,9 +44,9 @@
|
|||||||
WHERE CONSTRAINT_TYPE = 'FOREIGN KEY'
|
WHERE CONSTRAINT_TYPE = 'FOREIGN KEY'
|
||||||
AND c.TABLE_SCHEMA = '".$db."' AND c.TABLE_NAME = '".$table."'
|
AND c.TABLE_SCHEMA = '".$db."' AND c.TABLE_NAME = '".$table."'
|
||||||
AND k.COLUMN_NAME = '".$name."'";
|
AND k.COLUMN_NAME = '".$name."'";
|
||||||
$result3 = mysql_query($q);
|
$result3 = mysqli_query($mysqli,$q);
|
||||||
|
|
||||||
while ($row = mysql_fetch_array($result3)) {
|
while ($row = mysqli_fetch_array($result3)) {
|
||||||
$xml .= '<relation table="'.$row["table"].'" row="'.$row["column"].'" />';
|
$xml .= '<relation table="'.$row["table"].'" row="'.$row["column"].'" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,10 +55,10 @@
|
|||||||
|
|
||||||
/* keys */
|
/* keys */
|
||||||
$q = "SELECT * FROM STATISTICS WHERE TABLE_NAME = '".$table."' AND TABLE_SCHEMA = '".$db."' ORDER BY SEQ_IN_INDEX ASC";
|
$q = "SELECT * FROM STATISTICS WHERE TABLE_NAME = '".$table."' AND TABLE_SCHEMA = '".$db."' ORDER BY SEQ_IN_INDEX ASC";
|
||||||
$result2 = mysql_query($q);
|
$result2 = mysqli_query($mysqli,$q);
|
||||||
$idx = array();
|
$idx = array();
|
||||||
|
|
||||||
while ($row = mysql_fetch_array($result2)) {
|
while ($row = mysqli_fetch_array($result2)) {
|
||||||
$name = $row["INDEX_NAME"];
|
$name = $row["INDEX_NAME"];
|
||||||
if (array_key_exists($name, $idx)) {
|
if (array_key_exists($name, $idx)) {
|
||||||
$obj = $idx[$name];
|
$obj = $idx[$name];
|
||||||
@@ -92,4 +93,4 @@
|
|||||||
$arr[] = '</sql>';
|
$arr[] = '</sql>';
|
||||||
return implode("\n",$arr);
|
return implode("\n",$arr);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user