From b64ed72e5e671e4151d9290b275ea7c90d1e963c Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Tue, 4 Feb 2003 13:40:38 +0000 Subject: [PATCH] check local_infile --- ChangeLog | 2 ++ ldi_check.php3 | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 305c0c5cd..dd836a82d 100755 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ $Source$ switching from one server to the other * db_details_qbe.php3: bug 661758 (undefined offset when doing a qbe and only table selected) + * ldi_check.php3: check local_infile on recent MySQL versions, + thanks to Alexander 2003-02-03 Michal Cihar * libraries/display_tbl.lib.php3, tbl_change.php3: Show blob size (RFE diff --git a/ldi_check.php3 b/ldi_check.php3 index 89898976d..cb687bf53 100755 --- a/ldi_check.php3 +++ b/ldi_check.php3 @@ -70,16 +70,22 @@ if (isset($btnLDI) && ($textfile != 'none')) { // 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'; } + + if (PMA_MYSQL_INT_VERSION > 40003) { + $tmp_query = "SHOW VARIABLES LIKE 'local\_infile'"; + $result = PMA_mysql_query($tmp_query); + if ($result != FALSE && mysql_num_rows($result) > 0) { + $query .= ' LOCAL'; + } + mysql_free_result($result); + } + $query .= ' INFILE \'' . $textfile . '\''; if (!empty($replace)) { $query .= ' ' . $replace;