Doc #55823 [Asn->Csd]: mysqli::query with MYSQLI_STORE_RESULT returns TRUE on an INSERT statement

From: Date: Fri, 22 Mar 2013 07:39:29 +0000
Subject: Doc #55823 [Asn->Csd]: mysqli::query with MYSQLI_STORE_RESULT returns TRUE on an INSERT statement
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-9688@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55823&edit=1

 ID:                 55823
 Updated by:         philip@php.net
 Reported by:        esaour at gmail dot com
 Summary:            mysqli::query with MYSQLI_STORE_RESULT returns TRUE
                     on an INSERT statement
-Status:             Assigned
+Status:             Closed
 Type:               Documentation Problem
 Package:            MySQLi related
 Operating System:   linux
 PHP Version:        Irrelevant
 Assigned To:        philip
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for the bug report, this has been fixed in SVN. Also, sorry for taking 
so long to respond. :]


Previous Comments:
------------------------------------------------------------------------
[2013-03-22 07:38:09] philip@php.net

Automatic comment from SVN on behalf of philip
Revision: http://svn.php.net/viewvc/?view=revision&revision=329870
Log: Documented PHP Bug #55823 -- _query() and _real_query() are different

------------------------------------------------------------------------
[2011-09-30 16:50:51] esaour at gmail dot com

Description:
------------
---
From manual page: http://www.php.net/mysqli.query
---
$results = $mysqli->query($sql_insert, MYSQLI_STORE_RESULT);
$results is TRUE


But,
$success =    $mysqli->real_query($sql_insert);
$results = $mysqli->store_result();
$results is FALSE

This is in direct contradiction with the docs of mysqli::QUERY
"Functionally, using this function is identical to calling mysqli_real_query() followed either
by mysqli_use_result() or mysqli_store_result()."

Test script:
---------------
$mysqli = new mysqli('localhost', 'test', 'test123',
'test');

$sql_insert = "INSERT test values (null,'aa')";  //test table has an
autoincrement ID column and a varchar(10) column

$success =    $mysqli->real_query($sql_insert);
$results = $mysqli->store_result();

var_dump($results);  // boolean false                                        

$results = $mysqli->query($sql_insert, MYSQLI_STORE_RESULT);

var_dump($results); // boolean true
$mysqli->close();

Expected result:
----------------
expecting $mysqli->query($sql_insert, MYSQLI_STORE_RESULT) to return FALSE

Actual result:
--------------
$mysqli->query($sql_insert, MYSQLI_STORE_RESULT); returns TRUE


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



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


Thread (2 messages)

« previous php.doc.bugs (#9688) next »