From 96ee5db83e79bea42ffb6924eaa7040e2663dadf Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Mon, 19 Oct 2009 04:35:25 +0000 Subject: [PATCH] Import CSV in transaction git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1196 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- adminer/select.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/adminer/select.inc.php b/adminer/select.inc.php index a7ad4aea..1d60eea1 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -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);