#28631 [NEW]: mysql load data query

From: Date: Fri, 04 Jun 2004 13:59:38 +0000
Subject: #28631 [NEW]: mysql load data query
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-60365@lists.php.net to get a copy of this message
From: g dot m dot seed at hw dot ac dot uk Operating system: Windows98 PHP version: 4.3.4 PHP Bug Type: MySQL related Bug description: mysql load data query Description: ------------ The "load data" with "local infile" is supported in MySQL4, and has been since version 3.22. However, when an SQL query is submitted using mysql_query() the error returned by mysql_error() states "The used command is not allowed with this MySQL version"? I have read through the php manual, mysql manual, php's bug search facilities and checked a mailing group and can't find any reference that states the "load data" command is not supported when using php4 and mysql4? Incidentally, the query executes as expected if run at the mysql> command line prompt. Comments on rebported bug #7244 state: "LOAD DATA INFILE (without LOCAL) seems to be ok." and it appears that the use of "local" is the problem. If so, then this is contrary to the MySQL manual which clearly states the use of "local". Furthermore, if you don't consider the omission of "local" to be a bug then it should be documented since it is extremely difficult to pin this one down. Reproduce code: --------------- $sqlQuery = "load data local infile 'filename.csv' into table exams fields terminated by ',' enclosed by '\"' lines terminated by '\\r\\n'"; $result = mysql_query($sqlQuery) or die("query failed, error=" . mysql_error() . "\n"); Expected result: ---------------- To insert the data from filename.csv Actual result: -------------- query failed, error=The used command is not allowed with this MySQL version -- Edit bug report at http://bugs.php.net/?id=28631&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28631&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28631&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28631&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28631&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28631&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28631&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28631&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28631&r=support Expected behavior: http://bugs.php.net/fix.php?id=28631&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28631&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28631&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28631&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28631&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28631&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28631&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28631&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28631&r=float

« previous php.bugs (#60365) next »