Bug #34700 no way to get row_count() info when using prepared statements
Submitted: 20 Feb 2008 18:49 Modified: 22 Feb 2008 14:04
Reporter: Joao Pedro Paula Pannain Souza Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Prepared statements Severity:S2 (Serious)
Version:5.0.51 OS:Windows
Assigned to: CPU Architecture:Any

[20 Feb 2008 18:49] Joao Pedro Paula Pannain Souza
Description:
Hi,

I found abount this bug in another number: 
http://bugs.mysql.com/bug.php?id=14956

But I'm using a store procedure to update some dates
and are using prepared statements. And When I call
row_count() in the sequence it return -1 always.

How to repeat:
Here the exemplo of parse code:

	set @SQLQuery = ' update t1 set id=10 '; 
	PREPARE SQLExec FROM @SQLQuery;
	EXECUTE SQLExec;
	DEALLOCATE PREPARE SQLExec;
	select ROW_COUNT();
[20 Feb 2008 19:06] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior:

create procedure p1()
begin
create table if not exists t1(id int);
insert into t1 values(1);
set @SQLQuery = ' update t1 set id=10 '; 
PREPARE SQLExec FROM @SQLQuery;
EXECUTE SQLExec;
select ROW_COUNT();
DEALLOCATE PREPARE SQLExec;
end
|
call p1();
ROW_COUNT()
1
[22 Feb 2008 14:04] Joao Pedro Paula Pannain Souza
I test with your example and give me return right now.

But I put the row_count after the Execute and are giving
the same error. But now its working.

Thanks a lot.

Parse the script of the store procedure i'm using are:
	PREPARE SQLExec FROM @SQLQuery;
	EXECUTE SQLExec;
	select ROW_COUNT() into SQLResult;
	DEALLOCATE PREPARE SQLExec;

	if SQLResult > 0 then
		select 'Ok!' as Message;
	else
		select 'Not Ok!' as Message;
	end if;