#40870 [Fbk->Opn]: Stored proc warning 1329 produces NULL result set

From: Date: Wed, 21 Mar 2007 07:52:08 +0000
Subject: #40870 [Fbk->Opn]: Stored proc warning 1329 produces NULL result set
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110628@lists.php.net to get a copy of this message
ID: 40870 User updated by: key88sf at gmail dot com Reported By: key88sf at gmail dot com -Status: Feedback +Status: Open Bug Type: MySQLi related Operating System: Windows Vista PHP Version: 5.2.1 New Comment: Database table to create (MySQL): CREATE TABLE affiliates ( affiliate_id int(11) NOT NULL auto_increment, user_name varchar(32) NOT NULL, password_hash char(32) NOT NULL, PRIMARY KEY (affiliate_id), UNIQUE KEY Index_User_Name (user_name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO affiliates (user_name, password_hash) VALUES( 'test', '9b93b6ff07bfb6463bd0b5a6e65c4125' ); PHP Script to Demonstrate Bug: <?php $dbConnection = mysqli_connect("localhost", "root", "password"); $userName = "test"; $passwordHash = md5("some junk"); $sql = sprintf("CALL LoginAffiliate('%s', '%s')", $userName, $passwordHash); $recordSet = mysqli_query( $dbConnection, $sql ); if ( !$recordSet ) { echo "ERROR:" . strval(mysqli_errno($dbConnection)); } else { echo "SUCCESS"; } die(); ?> Previous Comments: ------------------------------------------------------------------------ [2007-03-20 19:35:53] tony2001@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2007-03-20 19:26:42] key88sf at gmail dot com 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 this bug report at http://bugs.php.net/?id=40870&edit=1

« previous php.bugs (#110628) next »