php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #41158 Add MYSQL_CLIENT_MULTI_RESULTS constant
Submitted: 2007-04-22 02:28 UTC Modified: 2007-04-24 11:12 UTC
From: zizka at seznam dot cz Assigned: georg (profile)
Status: Wont fix Package: Feature/Change Request
PHP Version: 5.2.1 OS: All
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zizka at seznam dot cz
New email:
PHP Version: OS:

 

 [2007-04-22 02:28 UTC] zizka at seznam dot cz
Description:
------------
Please add MYSQL_CLIENT_MULTI_RESULTS to MySQL extension.

Sometimes a situation arises that this constant is needed even though multiple results support is not needed. Currently everyone has to add 

  define('MYSQL_CLIENT_MULTI_RESULTS', 131072);

to his code.


Reproduce code:
---------------
<?php
$conn = mysql_connect("localhost", "root", "", 1, MYSQL_CLIENT_MULTI_RESULTS);
?>

Expected result:
----------------
...

Actual result:
--------------
...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-23 09:08 UTC] tony2001@php.net
>Sometimes a situation arises that this constant is needed even 
>though multiple results support is not needed. 

For instance?
 [2007-04-23 18:49 UTC] zizka at seznam dot cz
For instance, in case of use of Stored Procedure which uses PREPARED statement which surely can not return a result (not SELECT or SHOW), but MySQL does not know it and marks the Stored Procedure as returning a record set, and then throws an exception "can t return a result set in the given context". With the flag MYSQL_CLIENT_MULTI_RESULTS, PHP is able to handle a "CALL ..." query without harming anything (tested).

I've seen some other cases when people on the forums use this flag to allow PHP's MySQL extension use Stored Procedures which for some similar reason marked as returning a result set but they do not.

This would be needed to document, that the constant is just for such purposes and the extension is not able to handle multiple results. That would also bring the information about such MySQL's behavior right into the PHP manual, what could, in my oppinion, help some programmers finding their 'bug' causing "can t return a result set in the given context".
 [2007-04-24 07:25 UTC] zizka at seznam dot cz
I also suggest to note in the documentation that when MySQL extension is used to retrieve multiple results with CLIENT_MULTI_RESULTS flag set, MySQL returns an error "Commands out of sync".
 [2007-04-24 11:12 UTC] georg@php.net
http://www.php.net/manual/en/ref.mysql.php:

Although this MySQL extension is compatible with MySQL 4.1.0 and greater, it doesn't support the extra functionality that these versions provide. For that, use the MySQLi extension.

Stored Procedures were introduced into MySQL 5.0, so you should use mysqli extension instead of mysql.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 21:01:28 2024 UTC