]> git.joonet.de Git - adminer.git/commitdiff
No query after unbuffered
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 11 Sep 2009 18:53:39 +0000 (18:53 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 11 Sep 2009 18:53:39 +0000 (18:53 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1094 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/include/export.inc.php

index c02122dd74023039cee79aad28c0828e15bde8bc..5a83bb2f1592aa3b8dcaffccedb9f72547c2ab3b 100644 (file)
@@ -120,9 +120,9 @@ function dump_data($table, $style, $select = "") {
                if ($_POST["format"] != "csv" && $style == "TRUNCATE+INSERT") {
                        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
                if ($result) {
-                       $fields = fields($table);
                        $insert = "";
                        $buffer = "";
                        while ($row = $result->fetch_assoc()) {
@@ -132,14 +132,13 @@ function dump_data($table, $style, $select = "") {
                                        if (!$insert) {
                                                $insert = "INSERT INTO " . idf_escape($table) . " (" . implode(", ", array_map('idf_escape', array_keys($row))) . ") VALUES";
                                        }
-                                       $row2 = array();
                                        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") {
                                                $set = array();
-                                               foreach ($row2 as $key => $val) {
+                                               foreach ($row as $key => $val) {
                                                        $set[] = idf_escape($key) . " = $val";
                                                }
                                                dump("$insert ($s) ON DUPLICATE KEY UPDATE " . implode(", ", $set) . ";\n");