Hello,
so, I'm playing a bit with MariaDB 10.0.29 and I cannot understand why FOUND_ROWS()
keeps returning the 1
whatever happens to the latest select query. Here's my test:
> CREATE TABLE `test` (`id` INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, `msg` VARCHAR(100) NULL) ENGINE = InnoDB;
Query OK, 0 rows affected
Time: 0.782s
> INSERT INTO `test` (`msg`) VALUES('apples'), ('oranges'), ('strawberries'), ('cherries'), ('random');
Query OK, 5 rows affected
Time: 0.180s
> SELECT SQL_CALC_FOUND_ROWS * FROM `test`;
+------+--------------+
| id | msg |
|------+--------------|
| 1 | apples |
| 2 | oranges |
| 3 | strawberries |
| 4 | cherries |
| 5 | random |
+------+--------------+
5 rows in set
Time: 0.003s
> SELECT FOUND_ROWS();
+----------------+
| FOUND_ROWS() |
|----------------|
| 1 |
+----------------+
1 row in set
Time: 0.002s
Expected result 5
. The same happens with MyISAM engine.
Any clue why this happens? To avoid any possible backside issue, I have tested from a fresh connection through the command line client, but it does not seems to make difference.
The online test with MySQL 5.6, instead, returns 0
, it is accessible here:
For the online test result I'm not sure it depends on SQLfiddle or it is MySQL 5.6.