Bug #16645 | FOUND_ROWS() Bug | ||
---|---|---|---|
Submitted: | 19 Jan 2006 18:07 | Modified: | 7 Mar 2006 22:53 |
Reporter: | Stéphane Petitcolas | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | Connector / NET | Severity: | S2 (Serious) |
Version: | 1.0.7 | OS: | Windows (WIN XP) |
Assigned to: | Reggie Burnett | CPU Architecture: | Any |
[19 Jan 2006 18:07]
Stéphane Petitcolas
[19 Jan 2006 18:51]
Valeriy Kravchuk
Thank you for a problem report. Please, send the SHOW CREATE TABLE test results, to be sure.
[20 Jan 2006 8:42]
Stéphane Petitcolas
CREATE TABLE `test` ( `testID` int(11) NOT NULL auto_increment, `testName` varchar(100) default '', PRIMARY KEY (`testID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1
[20 Jan 2006 9:06]
Aleksey Kishkin
it works properly at least on linux. Going to test it on very win xp. bin/mysql -u root test Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 5.0.18-max Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> CREATE TABLE `test` ( -> `testID` int(11) NOT NULL auto_increment, -> `testName` varchar(100) default '', -> PRIMARY KEY (`testID`) -> ) ENGINE=InnoDB DEFAULT CHARSET=latin1; Query OK, 0 rows affected (0.01 sec) mysql> delimiter // mysql> create procedure filltest(IN counter INT) begin declare i integer; set i = 1; while i <= counter do insert into test (testName) values('bebe'); set i = i + 1; END WHILE ; END// Query OK, 0 rows affected (0.00 sec) mysql> call filltest(1000)// Query OK, 1 row affected (1.05 sec) mysql> select count(*) from test// +----------+ | count(*) | +----------+ | 1000 | +----------+ 1 row in set (0.00 sec) mysql> SELECT SQL_CALC_FOUND_ROWS * FROM test LIMIT 0, 10 // +--------+----------+ | testID | testName | +--------+----------+ | 1 | bebe | | 2 | bebe | | 3 | bebe | | 4 | bebe | | 5 | bebe | | 6 | bebe | | 7 | bebe | | 8 | bebe | | 9 | bebe | | 10 | bebe | +--------+----------+ 10 rows in set (0.00 sec) mysql> SELECT FOUND_ROWS()// +--------------+ | FOUND_ROWS() | +--------------+ | 1000 | +--------------+ 1 row in set (0.00 sec)
[20 Jan 2006 10:02]
Stéphane Petitcolas
Sorry. After tests, the bug is not due to MySQL server. But, the bug is due to the MySQL Connector Net 1.0.7. So, the bug still running in my project.
[20 Jan 2006 10:04]
Stéphane Petitcolas
More precision : the query is correct with : MySQL Connector Net 1.0.7 + MySQL Server 5.0.18. there is a bug with : MySQL Connector Net 1.0.7 + MySQL Server 4.1. It's the same with MySQL Connector Net 1.0.6
[20 Jan 2006 10:05]
Stéphane Petitcolas
UPDATE More precision : the query is correct with : MySQL Connector Net 1.0.7 + MySQL Server 4.1. there is a bug with : MySQL Connector Net 1.0.7 + MySQL Server 5.0.18. It's the same with MySQL Connector Net 1.0.6
[7 Mar 2006 22:53]
Reggie Burnett
Unable to reproduce. Can you post a test case and table script that shows the problem. Here is the test case I used that works against MySql 5.0.18-nt [Test] public void FoundRows() { execSQL("DROP TABLE IF EXISTS test"); execSQL("CREATE TABLE test (testID int(11) NOT NULL auto_increment, " + "testName varchar(100) default '', PRIMARY KEY (testID)) " + " ENGINE=InnoDB DEFAULT CHARSET=latin1"); MySqlCommand cmd = new MySqlCommand("INSERT INTO test VALUES (NULL, 'test')", conn); for (int i=0; i < 1000; i++) cmd.ExecuteNonQuery(); cmd.CommandText = "SELECT SQL_CALC_FOUND_ROWS * FROM test LIMIT 0, 10"; cmd.ExecuteNonQuery(); cmd.CommandText = "SELECT FOUND_ROWS()"; object cnt = cmd.ExecuteScalar(); Assert.AreEqual(1000, cnt); }
[7 Mar 2006 22:55]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/3566