Bug #55737 [Fbk->Nab]: LOAD DATA LOCAL INFILE - The used command is not allowed with this MySQL versio

From: Date: Fri, 04 May 2012 13:46:45 +0000
Subject: Bug #55737 [Fbk->Nab]: LOAD DATA LOCAL INFILE - The used command is not allowed with this MySQL versio
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-170173@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55737&edit=1

 ID:                 55737
 Updated by:         uw@php.net
 Reported by:        stefan dot kaifer at hartmann dot info
 Summary:            LOAD DATA LOCAL INFILE - The used command is not
                     allowed with this MySQL versio
-Status:             Feedback
+Status:             Not a bug
 Type:               Bug
 Package:            MySQL related
 Operating System:   opensuse 11.0
 PHP Version:        5.3.8
 Assigned To:        mysql
 Block user comment: N
 Private report:     N

 New Comment:

So, what is this report about? If it's on ext/mysql, I call it not a bug. Thus, closing. If
config is correct, things work just fine.

----------
$host = "localhost:/var/run/mysql/mysql.sock";
$user = "root";
$pass = "";
$flags = 128;
$db = "test";

printf("PHP %s\n", PHP_VERSION);

$file = getcwd() . DIRECTORY_SEPARATOR . "foo.txt";
if (!($fp = fopen($file, "w")))
	die(sprintf("Failed to open '%s' for writing\n", $file));

if (!fwrite($fp, "1;a\n") || !fwrite($fp, "2;b\n"))
	die(sprintf("Failed to write to '%s'\n", $file));

fclose($fp);

$sql = sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE test FIELDS TERMINATED BY
';'", $file);

if (!($mysql = mysql_connect($host, $user, $pass, true, $flags)))
  die(sprintf("Failed to connect to MySQL\n"));

printf("MySQL %s\n", mysql_get_server_info($mysql));

mysql_select_db($db);
mysql_query("DROP TABLE IF EXISTS test", $mysql);
mysql_query("CREATE TABLE test(id INT, col_a VARCHAR(255))", $mysql);

mysql_close($mysql);

if (!($mysql = mysql_connect($host, $user, $pass, true, $flags)))
  die(sprintf("Failed to connect to MySQL\n"));

if (!mysql_db_query($db, $sql, $mysql))
  die(sprintf("LOAD DATA failed: %s\n", mysql_error($mysql)));


$res = mysql_query("SELECT * FROM test", $mysql);
while ($row = mysql_fetch_row($res))
	var_dump($row);

-------- gives -------------

PHP 5.3.12-dev                                                                                      
                                                                               
MySQL 5.5.16-log                                                                                    
                                                                               
array(2) {                                                                                          
                                                                               
  [0]=>                                                                                          
                                                                                  
  string(1) "1"                                                                           
                                                                                         
  [1]=>                                                                                          
                                                                                  
  string(1) "a"                                                                           
                                                                                         
}                                                                                                   
                                                                               
array(2) {                                                                                          
                                                                               
  [0]=>                                                                                          
                                                                                  
  string(1) "2"                                                                           
                                                                                         
  [1]=>                                                                                          
                                                                                  
  string(1) "b"                                                                           
                                                                                         
}


Previous Comments:
------------------------------------------------------------------------
[2012-02-02 14:55:26] stefan dot kaifer at hartmann dot info

Hi

sorry for the late answer: 5.3.4 worked for me, 5.3.4 to 5.3.7 I don't tested!
5.3.8 and 5.3.9 dont't works for me. I've compiled all versions with the same
"configure"-parameters.

I hope, that somebody can solve the problem.

Best reguards

Stefan

------------------------------------------------------------------------
[2011-10-25 19:21:14] richardpq at gmail dot com

I haven't test this functionality before, this is the first time that I tested 
it. 

@Stefan point that it was working before and now not, but I don't know which 
version he use... At the moment I am testing locally so I can put the files in my 
mysql data directory and it works, but I don't know, what I will do when I have 
to upload to the server since is not a private server.

------------------------------------------------------------------------
[2011-10-25 18:53:41] andrey@php.net

Which is the last version of 5.3 which worked for you?

------------------------------------------------------------------------
[2011-10-25 18:36:30] richardpq at gmail dot com

andrey@php.net,

Neither 5.3snv and 5.3.8 snv work, the same problem

------------------------------------------------------------------------
[2011-10-21 11:20:24] andrey@php.net

Can you try 5.3-svn? Altough the NEWS entry mentions 5.4 the fix has landed in 5.3 too (committed on
Sep 2). 5.3.8 was released on Aug 23rd.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=55737


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55737&edit=1


Thread (25 messages)

« previous php.bugs (#170173) next »