doctrine/dbal — pull request #115 by nicolas-grekas (2012-02-17 13:17:59+00:00)
Title: Default fetch mode for Connection and fixing it for Statement classes

- setFetchMode() signature was inconsistent among Statement classes (1st arg sometimes optional, sometimes mandatory). This is fixed in the first commit (always mandatory).

- $fetchStyle arguments in Statement classes were inconsistent : they default sometimes to NULL, sometimes to PDO::FETCH_BOTH. When defaulting to PDO::FETCH_BOTH, the default fetch mode was not honored. This is fixed in second commit (always defaults to NULL and honor default fetch mode).

- the third commit adds a "setFetchMode()" at the connection level. This fetch mode defaults to PDO::FETCH_ASSOC, so that Connection->fetchAll() remains the same. Statements returned by methods of the Connection class are now set to the connection fetch mode. This breaks backward compatibility for scripts that used the FETCH_BOTH behavior of statements returned by Connection. But that seams a necessary coherency change to me. I can't for example find a reason why Connection->fetchAll() always returns a "PDO::FETCH_ASSOC"ed array, where Connection->query($sql)->fetchAll() returns "PDO::FETCH_BOTH"ed one.