ngduc / Thin-PHP-Framework

A micro web framework - lightweight and flexible open source PHP5 MVC framework
http://www.thinphp.com
Other
41 stars 17 forks source link

[BUG][MODEL]BaseDAO->getAll() #11

Closed bmaingret closed 12 years ago

bmaingret commented 12 years ago

Hi, There is a problem with this method and sqlite : $sql = 'SELECT * FROM ' . $this->table . $strWhere . $strOrderBy; $stmt = $this->prepareExecute($sql, null ); if ($stmt && $stmt->rowCount() > 0){ return $stmt->fetchAll(); }

The problem is that on SELECT queries, the rowCount is undefined (cf. http://www.php.net/manual/en/pdostatement.rowcount.php)

I commented the rowCount > 0.

Ubuntu 12.04 64bits SQLite 3.7.9 2011-11-01 00:52:41 c7c6050ef060877ebe77b41d959e9df13f8c9b5e Last Version of thinphp

ngduc commented 12 years ago

Thanks for pointing out, seven-up, rowCount() works for me (mysql, sqlite3), but php docs says that "this behaviour is not guaranteed for all databases". I will remove it in the next version.

ngduc commented 12 years ago

I have just reproduced the bug & removed rowCount() from getAll().

v0.55 https://github.com/ngduc/Thin-PHP-Framework/commit/50b7b83acf7b583fc946878cc23b49be777a7fe3