|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #56436 Allow PDO class to set defaut PDOStatement::Fetch mode
Submitted: 2005-07-02 18:04 UTC Modified: 2014-01-02 15:53 UTC
From: php dot net at sharpdreams dot com Assigned:
Status: Duplicate Package: *General Issues
PHP Version: 5_1 CVS-2005-07-02 (dev) OS: *
Private report: No CVE-ID: None
 [2005-07-02 18:04 UTC] php dot net at sharpdreams dot com
The PDO class ought to have a "setDefaultFetchMode()" function that when called, sets all subsequent PDOStatements to have that fetch mode.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-03 10:42 UTC] akorthaus at web dot de
I second that. 

If not an implementing an extra function, one could implement an attribute to use with PDO::setAttribute (I'd prefer a function).
 [2005-08-30 23:25 UTC]
Won't be in 5.1, and quite possibly won't be implemented at all.
 [2005-09-01 09:28 UTC] akorthaus at web dot de
This is the only problem which prevents many people from using PDO itself. 

If you have 20 queries in one script and you don't use the default FetchMode, hardcoded in the PDO source, you have to spread 20 PDOStatement::setFetchMode() calls all over your code, which could be easily avoided if it was possible to set the default-FetchMode once in the script.

Or do you think everybody using PDO must use a wrapper-class?
 [2005-10-19 08:44 UTC] akorthaus at web dot de
There is another bug in the php bug-tracker, with more detailed information and a first patch to implement a PDO::setDefaultFetchMode() methode (incomplete):
 [2014-01-02 15:53 UTC]
-Package: PDO +Package: *General Issues
 [2014-01-02 15:53 UTC]
Dupe of closed bug #34909.
 [2014-01-02 15:53 UTC]
-Status: Suspended +Status: Duplicate -Assigned To: helly +Assigned To:
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jan 17 22:01:33 2021 UTC