From 184060e800006d8ac61e5c7e74c918d2467536dc Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 14 Dec 2002 12:35:40 +0000 Subject: [PATCH] bug 530255 --- ChangeLog | 3 +++ ldi_check.php3 | 23 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 81a77424d..1f7789569 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ phpMyAdmin - Changelog $Id$ $Source$ +2002-12-14 Marc Delisle + * ldi_check.php3: bug 530255 (LOAD DATA LOCAL INFILE) + 2002-12-13 Michal Cihar * tbl_dump.php3: Fix output order of inserts/creates, generate file extension to include also file type, not only compression (now it diff --git a/ldi_check.php3 b/ldi_check.php3 index a536b229e..89898976d 100755 --- a/ldi_check.php3 +++ b/ldi_check.php3 @@ -58,8 +58,29 @@ if (isset($btnLDI) && ($textfile != 'none')) { $column_name = PMA_sqlAddslashes($column_name); } + // (try to) make sure the file is readable: + chmod($textfile, 0777); + // Builds the query - $query = 'LOAD DATA LOCAL INFILE \'' . $textfile . '\''; + $query = 'LOAD DATA'; + + // for versions before 3.23.49, we use the LOCAL keyword, because + // there was a version (cannot find which one, and it does not work + // with 3.23.38) where the user can LOAD, even if the user does not + // have FILE priv, and even if the file is on the server + // (which is the present case) + // + // if we find how to check the server about --local-infile + // and --enable-local-infile, we could modify the code + // to use LOCAL for version >= 32349 if the server accepts it + // + // we could also code our own loader, but LOAD DATA INFILE is optimized + // for speed + + if (PMA_MYSQL_INT_VERSION < 32349) { + $query .= ' LOCAL'; + } + $query .= ' INFILE \'' . $textfile . '\''; if (!empty($replace)) { $query .= ' ' . $replace; }