From:             key88sf at gmail dot com
Operating system: Windows Vista
PHP version:      5.2.1
PHP Bug Type:     MySQLi related
Bug description:  Stored proc warning 1329 produces NULL result set

Description:
------------
I have a simple stored procedure in MySQL 5.x. The proc first does a
SELECT INTO query, followed by a regular SELECT to return it's result set.

The SELECT INTO generates a warning 1329 because no rows were fetched.
However, the final SELECT works properly and returns 1 row.

However, the result returned from mysqli_query() is NULL !


Reproduce code:
---------------
Stored proc is this:

  DECLARE v_affiliate_id INTEGER DEFAULT NULL;

  -- This SELECT INTO returns 0 rows:
  select
        affiliate_id INTO v_affiliate_id 
  from 
        affiliates 
  where 
        user_name = v_user_name 
        and password_hash = v_password_hash;

  if ( v_affiliate_id IS NULL ) THEN
    SET v_affiliate_id := -1;
  end if;

  -- This is the result set row:
  select v_affiliate_id;


Expected result:
----------------
When I run this from the MySQL command line, I get 1 row, 1 warning
(1329).

When I run from PHP, I *expect* to see a result set with 1 row.

Actual result:
--------------
When I run from PHP, the result set from mysqli_query() is NULL.

-- 
Edit bug report at http://bugs.php.net/?id=40870&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40870&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40870&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40870&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40870&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40870&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40870&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40870&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40870&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40870&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40870&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40870&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40870&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40870&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40870&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40870&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40870&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40870&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40870&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40870&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40870&r=mysqlcfg

Reply via email to