summaryrefslogtreecommitdiff
path: root/mysql-test/t/ps.test
diff options
context:
space:
mode:
authorunknown <pem@mysql.comhem.se>2004-06-22 19:38:07 +0200
committerunknown <pem@mysql.comhem.se>2004-06-22 19:38:07 +0200
commit3df8b829b6054da7f0e275b5f5edd33f1456ec33 (patch)
tree0ec3a45a9e2b366990567cba2d2b6b9848869dd1 /mysql-test/t/ps.test
parent84afec5bfa6ae2a675667ed0399592bb1e2bbe86 (diff)
downloadmariadb-git-3df8b829b6054da7f0e275b5f5edd33f1456ec33.tar.gz
Fixed BUG#3486: FOUND_ROWS() fails inside stored procedure [and prepared statement].
mysql-test/r/ps.result: New test case for BUG#3486. mysql-test/t/ps.test: New test case for BUG#3486. sql/item_create.cc: Create an Item_func_found_rows() at parse time, not an Item_int. sql/item_func.cc: Added val_int() method for new Item_func_found_rows class. sql/item_func.h: New class Item_func_found_rows for FOUND_ROWS() function. sql/sql_select.cc: Don't reset thd->limit_found_rows too early, or FOUND_ROWS() wont work.
Diffstat (limited to 'mysql-test/t/ps.test')
-rw-r--r--mysql-test/t/ps.test16
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index f379fb3eebe..8881d6b9eec 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -124,3 +124,19 @@ PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
set @var='A';
EXECUTE stmt1 USING @var;
DEALLOCATE PREPARE stmt1;
+
+#
+# BUG#3486: FOUND_ROWS() fails inside stored procedure [and prepared statement]
+#
+create table t1 (id int);
+prepare stmt1 from "select FOUND_ROWS()";
+select SQL_CALC_FOUND_ROWS * from t1;
+# Expect 0
+execute stmt1;
+insert into t1 values (1);
+select SQL_CALC_FOUND_ROWS * from t1;
+# Expect 1
+execute stmt1;
+# Expect 0
+execute stmt1;
+deallocate prepare stmt1;