]> git.joonet.de Git - adminer.git/commitdiff
Import CSV in transaction
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Mon, 19 Oct 2009 04:35:25 +0000 (04:35 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Mon, 19 Oct 2009 04:35:25 +0000 (04:35 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1196 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/select.inc.php

index a7ad4aea738ce9f27e772a5d937c7d7570b9769f..1d60eea164e85af22d91a3d4cd2ce394bc97e145 100644 (file)
@@ -93,6 +93,7 @@ if ($_POST && !$error) {
                        $cols = array_keys($fields);
                        preg_match_all('~("[^"]*"|[^"\\r\\n])+~', $file, $matches);
                        $affected = count($matches[0]);
+                       queries("START TRANSACTION");
                        foreach ($matches[0] as $key => $val) {
                                preg_match_all('~(("[^"]*")+|[^,]*),~', "$val,", $matches2);
                                if (!$key && !array_diff($matches2[1], $cols)) { //! doesn't work with column names containing ",\n
@@ -111,6 +112,7 @@ if ($_POST && !$error) {
                                        }
                                }
                        }
+                       queries("COMMIT");
                        queries_redirect(remove_from_uri("page"), lang('%d row(s) have been imported.', $affected), $result);
                } else {
                        $error = upload_error($file);