]> git.joonet.de Git - adminer.git/commitdiff
Improve CSV; export
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 22 Apr 2010 23:03:54 +0000 (23:03 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 22 Apr 2010 23:03:54 +0000 (23:03 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1481 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/dump.inc.php
adminer/include/functions.inc.php
adminer/select.inc.php

index 137bd0ec51a3f26f40ba2eae97c959e235e2e543..cc67e9ff1e030afd76472dbdbbf93324292f55bb 100644 (file)
@@ -156,7 +156,7 @@ page_header(lang('Export'), "", ($_GET["export"] != "" ? array("table" => $_GET[
 $db_style = array('', 'USE', 'DROP+CREATE', 'CREATE');
 $table_style = array('', 'DROP+CREATE', 'CREATE');
 $data_style = array('', 'TRUNCATE+INSERT', 'INSERT', 'INSERT+UPDATE');
-if (support("routine")) {
+if ($driver == "sql") {
        $db_style[] = 'CREATE+ALTER';
        $table_style[] = 'CREATE+ALTER';
 }
index 0fd866dacd8cbc453e4438bba393e5699ad6f599..8374b8359c3ffc02d22128ebae510002d0cabdb6 100644 (file)
@@ -598,7 +598,7 @@ function dump_csv($row) {
                        $row[$key] = '"' . str_replace('"', '""', $val) . '"';
                }
        }
-       echo implode(($_POST["format"] == "csv;" ? ";" : ","), $row) . "\n";
+       echo implode(($_POST["format"] == "csv" ? "," : ";"), $row) . "\n";
 }
 
 /** Apply SQL function
index 508bccc042815bfb17b1d563302f5f988eba780a..57a18db03badd5fe609a28c18fef76c9e9a16f7a 100644 (file)
@@ -112,7 +112,7 @@ if ($_POST && !$error) {
                        preg_match_all('~(?>"[^"]*"|[^"\\r\\n]+)+~', $file, $matches);
                        $affected = count($matches[0]);
                        queries("START TRANSACTION");
-                       $separator = ($_POST["separator"] == ";" ? ";" : ",");
+                       $separator = ($_POST["separator"] == "csv" ? "," : ";");
                        foreach ($matches[0] as $key => $val) {
                                preg_match_all("~((\"[^\"]*\")+|[^$separator]*)$separator~", $val . $separator, $matches2);
                                if (!$key && !array_diff($matches2[1], $cols)) { //! doesn't work with column names containing ",\n
@@ -132,7 +132,7 @@ if ($_POST && !$error) {
                                }
                        }
                        if ($result) {
-                       queries("COMMIT");
+                               queries("COMMIT");
                        }
                        queries_redirect(remove_from_uri("page"), lang('%d row(s) have been imported.', $affected), $result);
                        queries("ROLLBACK");
@@ -327,7 +327,7 @@ if (!$columns) {
                }
                print_fieldset("import", lang('CSV Import'), !$result->num_rows);
                echo "<input type='hidden' name='token' value='$token'><input type='file' name='csv_file'> ";
-               echo html_select("separator", array(",", ";"), ($adminer_export["format"] == "csv;" ? ";" : ","), 1); // 1 - select
+               echo html_select("separator", array("csv" => "CSV,", "csv;" => "CSV;"), $adminer_export["format"], 1); // 1 - select
                echo " <input type='submit' name='import' value='" . lang('Import') . "'>\n";
                echo "</div></fieldset>\n";