[php-maint] Bug#552089: php5-mysql: failed to call stored procedure via mysql_query function

Alexey Popoudin neo.obninsk at gmail.com
Fri Oct 23 09:43:25 UTC 2009


Package: php5-mysql
Version: 5.2.6.dfsg.1-1+lenny3
Severity: normal

PHP 5.2.6-1+lenny3 with Suhosin-Patch 0.9.6.2 (cgi-fcgi) (built: Apr 26 2009 22:11:16)
mysql  Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2

Create php file with content below and follow steps in it.
<?php
/* 1. Create test_proc procedure, using mysql utility, or by any other way.
 * 2. Run this php code.
 * 3. It should print current date and time.
 * 4. But it print this:
 * PROCEDURE mysql.test_proc can't return a result set in the given context
 * ----
 * To create test_proc you can use this commands:
mysql -p -u root mysql
 * Will ask for root password here.
DELIMITER //
CREATE PROCEDURE test_proc () SELECT NOW();//
 * To remove procedure use:
DROP PROCEDURE test_proc//
*/
// This not work:
	$db_link_identifier = mysql_pconnect('127.0.0.1', 'root', '15fp731')
		or die('connect failed: '.mysql_error());
	mysql_select_db('mysql')
		or die('select database failed: '.mysql_error());
	$query_result =
		mysql_query('CALL test_proc;')
		//mysql_query('SELECT NOW();')
		or die('query failed: '.mysql_error());
	$result = mysql_result($query_result, 0)
		or die('no result');
	echo($result);

// This work:
/*
	$mysqli = mysqli_init()
		or die('mysqli_init failed');
	$mysqli->real_connect('127.0.0.1', 'root', '15fp731', 'mysql')
		or die('connect failed: '.mysqli_connect_error());
	$mysqli->real_query ("CALL test_proc();")
		or die('query failed: '.$mysqli->error);
	$mysqli_result = $mysqli->store_result()
		or die('store result failed: '.$mysqli->error);
	$row = $mysqli_result->fetch_row()
		or die('no result');
	echo($row[0]);
*/
?>


-- System Information:
Debian Release: 5.0.3
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages php5-mysql depends on:
ii  libc6              2.7-18                GNU C Library: Shared libraries
ii  libmysqlclient15of 5.0.51a-24+lenny2     MySQL database client library
ii  php5-cgi [phpapi-2 5.2.6.dfsg.1-1+lenny3 server-side, HTML-embedded scripti
ii  php5-common        5.2.6.dfsg.1-1+lenny3 Common files for packages built fr

php5-mysql recommends no packages.

php5-mysql suggests no packages.

-- no debconf information





More information about the pkg-php-maint mailing list