Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.0b5

Bug #8426 Error on Empty Result Set
Submitted: 2006-08-13 22:28 UTC
From: tehjcon at gmail dot com Assigned:
Status: No Feedback Package: MDB2 (version 2.2.0)
PHP Version: 5.1.4 OS: Debian 3.4.3
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 43 + 39 = ?

 
 [2006-08-13 22:28 UTC] tehjcon at gmail dot com (Jcon)
Description: ------------ This error was caused with the mysqli driver. PHP 5.1.4, MYSQL 5.0.22 Fatal error: MDB2 Error: Array in /(path_to_files)/includes/dbfs.php on line 50 Returns PEAR error class instead of NULL or '' When returning zero rows from $db->queryOne Test script: --------------- $sql = 'SELECT last_modified_time FROM ' . FILES_TABLE . ' WHERE file_path = ' . $db->quote((string) $file_path); $last_modified_time = $db->queryOne($sql); if (PEAR::isError($last_modified_time)) { var_dump($last_modified_time); } Expected result: ---------------- Nothing, no errors. I would expect that $last_modified_time is NULL when there are no rows that match the query. Actual result: -------------- $last_modified_time is a PEAR error class. The query works fine when i execute it with the packaged mysql client.

Comments

 [2006-08-13 22:33 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-08-14 14:57 UTC] tehjcon at gmail dot com
Actually using queryRow() I get the same error. Sorry about being less specific the "Fatal error:" was from the error handler I'm using but the string "MDB2 Error: Array" is what is returned from $result->getMessage(). Note: The query that its executing has a return of zero rows (at the moment at least) and that seems to be causing the error, the same code works as expected when returning at least 1 row. MDB2_Error Object ( [error_message_prefix] => [mode] => 1 [level] => 1024 [code] => [message] => MDB2 Error: Array [userinfo] => _doQuery: [Error message: Could not execute statement] [Last query: SELECT last_modified_time FROM js_files WHERE file_path = 'cms/edit.htm'] [Native code: 2013] [Native message: Lost connection to MySQL server during query]
 [2006-08-14 17:37 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-08-14 17:43 UTC] phanslem at hotmail dot com (pierre)
Have tested also here with the same config and i got the "NULL" result. Same opinion as Lukas... Normally an empty result should not end on a broken connection. Did you try to execute this query directly on the server?
 [2006-08-14 18:23 UTC] tehjcon at gmail dot com
Yes the query works fine... mysql> SELECT last_modified_time FROM js_files WHERE file_path='cms/edit.php'; Empty set (0.00 sec) Also, the query works fine when returning 1 or more rows; no broken connection.
 [2006-08-14 18:25 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-08-19 19:03 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-08-20 17:08 UTC] tehjcon at gmail dot com
Was not able to recreate the error with the api directly. I made a breif script to test the same query as one failing in MDB2 (verbatim). At this point I think the bug no longer is confined to zero row results. There must be another cause because the script below returns 1 row as expected with mysqli api. However, with mdb2 it returns the dreaded PEAR error class. At this point I'm totally lost as to what might be the cause other than a strange bug in MDB2. // Test Script $conn = mysqli_connect('localhost', 'root', '', 'database'); if (!$conn) { printf("Connection Failed: %s\n", mysqli_connect_error()); exit; } $sql = 'CALL LoadFile(0,\'/header.htm\',\'file_path\')'; $result = mysqli_query($conn, $sql); while($row = mysqli_fetch_assoc($result)) { print_r($row); } mysqli_free_result($result); mysqli_close($conn); The script above returns the expected result set... Array ( [file_id] => 6 [parent_id] => 1 [bottom_id] => 14 [top_id] => 15 [filetype] => 1 [filename] => header.htm [file_path] => /header.htm [file_size] => 2093 ..... etc
 [2006-08-20 18:13 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-08-20 18:31 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-10-01 16:01 UTC] maw01 at student dot uwa dot edu dot au (Vincent)
Hello! How can I enable 'multi_query' option? Thanks!
 [2006-10-01 16:36 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-10-02 04:20 UTC] maw01 at student dot uwa dot edu dot au (Vincent)
If I add $mdb2->setOption('multi_query', true); Then do I still need to iterate over all results inside my result class instance using the nextResult() method?
 [2006-10-02 06:11 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-10-02 12:06 UTC] maw01 at student dot uwa dot edu dot au (Vincent)
hello! If I call this procedure $sql = "call pay(".$transaction_id.",".$member_id.",".$dvd_id.", null)"; I think there have a problem if I put null in the parameter! Is it? How can I solve this problem? But my procedure can accept null!!! Error message: [Mon Oct 02 20:01:53 2006] [error] [client 203.161.68.3] PHP Fatal error: Cannot use object of type MDB2_Error as array in /mnt/data0/jklf/wxyz/public_html/pay.php on line 124, referer: http://address/folder/pay.php
 [2006-10-02 12:12 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!