From:             
Operating system: Mac OS
PHP version:      5.3.4
Package:          MySQL related
Bug Type:         Bug
Bug description:mysql_query with "load data" unable to save result set

Description:
------------
I believe that using mysql_query() with "load data" should always be a 

TRUE/FALSE return value. However, if a mysql_query() call that returns a
result 

set is performed *before* the "load data" query, then there is a warning
stating 

that the result set can not be saved.



In short:

Warning:

 mysql_query("SELECT ..."); // result set *before*

 mysql_query("LOAD DATA ..."); // warning



Works:

 mysql_query("LOAD DATA ..."); // works

 mysql_query("SELECT ..."); // result set *after*



Works:

 mysql_query("UPDATE ..."); // *no* result set

 mysql_query("LOAD DATA ..."); // works



Works and Warning:

 mysql_query("LOAD DATA ..."); // works

 mysql_query("SELECT ..."); // result set *after*

 mysql_query("LOAD DATA ..."); // warning





MacOS 10.5.8

$ uname -a

Darwin clark-kent-2.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15
16:55:01 

PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386



Using PHP from macports

$ php --version

PHP 5.3.3 (cli) (built: Oct 25 2010 17:21:53) 

Copyright (c) 1997-2010 The PHP Group

Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies



$ php -i

phpinfo()

PHP Version => 5.3.3



System => Darwin clark-kent-2.local 9.8.0 Darwin Kernel Version 9.8.0: Wed
Jul 

15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386

Build Date => Oct 25 2010 17:19:57

Configure Command =>  './configure'  '--prefix=/opt/local' '--

mandir=/opt/local/share/man' '--infodir=/opt/local/share/info'
'--with-config-

file-path=/opt/local/etc/php5' '--with-config-file-scan-

dir=/opt/local/var/db/php5' '--disable-all' '--enable-bcmath'
'--enable-ctype' 

'--enable-dom' '--enable-fileinfo' '--enable-filter' '--enable-hash'
'--enable-

json' '--enable-libxml' '--enable-pdo' '--enable-phar' '--enable-session'
'--

enable-simplexml' '--enable-tokenizer' '--enable-xml' '--enable-xmlreader'
'--

enable-xmlwriter' '--with-bz2=/opt/local' '--with-mhash=/opt/local'
'--with-

pcre-regex=/opt/local' '--with-readline=/opt/local' '--with-libxml-

dir=/opt/local' '--with-zlib=/opt/local' '--disable-cgi' '--with-

apxs2=/opt/local/apache2/bin/apxs' '--with-pear=/opt/local/lib/php'





Using MySQL from macports

$ mysql --version

mysql  Ver 14.14 Distrib 5.1.51, for apple-darwin9.8.0 (i386) using
readline 6.1





Test script:
---------------
<?php

error_reporting(E_ALL | E_STRICT);

$sql = "LOAD DATA LOCAL INFILE '/tmp/a.out' INTO TABLE tmp (value)";

$db = mysql_connect('localhost', 'root', 'password');

mysql_select_db('some_database');



// "load data" *before* another query will work

// (this will return TRUE)

print ("This works\n");

$works = mysql_query($sql, $db);



print ("This also works\n");

$also_works = mysql_query("SELECT * FROM tmp", $db);



// "load data" *after* a query produces warning about not saving result
set

// (should return TRUE/FALSE I believe)

print ("This fails with warning\n");

$fails_with_warning = mysql_query($sql, $db);

?>

Expected result:
----------------
This works

This also works

This fails with warning

Actual result:
--------------
This works

This also works

This fails with warning

Warning: mysql_query(): Unable to save result set in tmp.php on line 18



-- 
Edit bug report at http://bugs.php.net/bug.php?id=53649&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53649&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53649&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53649&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53649&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53649&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53649&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53649&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53649&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53649&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53649&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53649&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53649&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53649&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53649&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53649&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53649&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53649&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53649&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53649&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53649&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53649&r=mysqlcfg

Reply via email to