php - PDO rowCount() Supported Databases -


i'm looking list of supported databases rowcount() method pdo. know sounds rftm question, cannot find @ relating specific databases work on. know manual:

pdostatement::rowcount() returns number of rows affected last delete, insert, or update statement executed corresponding pdostatement object.

if last sql statement executed associated pdostatement select statement, some databases may return number of rows returned statement. however, behaviour not guaranteed databases , should not relied on portable applications.

i know works in mysql, , not work on ms server other databases pdo supports?

because of documented restriction, , recognizing current computers have lots of memory, portable, , in cases fastest, implementation issue $result = $stmt->fetchall() , use count($result).

in opinion code looks cleaner since loop through returned values becomes simple foreach($result $row). faster implementation 2 reasons:

  • the database driver can optimize fetchall, example mysql documented buffer result in case
  • the loop through records not involve call out of script driver.

since going reading every row of reply before completing response end user, why not @ once single call driver? implementing rowcount select in db independent way requires issuing separate select count(*) request.

it takes effort driver perform select count(*) actual select, doubling time process request.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -