No query after unbuffered
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1094 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
1d57946d12
commit
a17748be22
|
@ -120,9 +120,9 @@ function dump_data($table, $style, $select = "") {
|
||||||
if ($_POST["format"] != "csv" && $style == "TRUNCATE+INSERT") {
|
if ($_POST["format"] != "csv" && $style == "TRUNCATE+INSERT") {
|
||||||
dump("TRUNCATE " . idf_escape($table) . ";\n");
|
dump("TRUNCATE " . idf_escape($table) . ";\n");
|
||||||
}
|
}
|
||||||
|
$fields = fields($table);
|
||||||
$result = $dbh->query(($select ? $select : "SELECT * FROM " . idf_escape($table)), 1); // 1 - MYSQLI_USE_RESULT //! enum and set as numbers, microtime
|
$result = $dbh->query(($select ? $select : "SELECT * FROM " . idf_escape($table)), 1); // 1 - MYSQLI_USE_RESULT //! enum and set as numbers, microtime
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$fields = fields($table);
|
|
||||||
$insert = "";
|
$insert = "";
|
||||||
$buffer = "";
|
$buffer = "";
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
@ -132,14 +132,13 @@ function dump_data($table, $style, $select = "") {
|
||||||
if (!$insert) {
|
if (!$insert) {
|
||||||
$insert = "INSERT INTO " . idf_escape($table) . " (" . implode(", ", array_map('idf_escape', array_keys($row))) . ") VALUES";
|
$insert = "INSERT INTO " . idf_escape($table) . " (" . implode(", ", array_map('idf_escape', array_keys($row))) . ") VALUES";
|
||||||
}
|
}
|
||||||
$row2 = array();
|
|
||||||
foreach ($row as $key => $val) {
|
foreach ($row as $key => $val) {
|
||||||
$row2[$key] = (isset($val) ? (ereg('int|float|double|decimal', $fields[$key]["type"]) ? $val : $dbh->quote($val)) : "NULL"); //! columns looking like functions
|
$row[$key] = (isset($val) ? (ereg('int|float|double|decimal', $fields[$key]["type"]) ? $val : $dbh->quote($val)) : "NULL"); //! columns looking like functions
|
||||||
}
|
}
|
||||||
$s = implode(",\t", $row2);
|
$s = implode(",\t", $row);
|
||||||
if ($style == "INSERT+UPDATE") {
|
if ($style == "INSERT+UPDATE") {
|
||||||
$set = array();
|
$set = array();
|
||||||
foreach ($row2 as $key => $val) {
|
foreach ($row as $key => $val) {
|
||||||
$set[] = idf_escape($key) . " = $val";
|
$set[] = idf_escape($key) . " = $val";
|
||||||
}
|
}
|
||||||
dump("$insert ($s) ON DUPLICATE KEY UPDATE " . implode(", ", $set) . ";\n");
|
dump("$insert ($s) ON DUPLICATE KEY UPDATE " . implode(", ", $set) . ";\n");
|
||||||
|
|
Loading…
Reference in a new issue