php.net |  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
Description:
------------
The PDO class ought to have a "setDefaultFetchMode()" function that when called, sets all subsequent PDOStatements to have that fetch mode.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] wez@php.net
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):

http://bugs.php.net/bug.php?id=34909
 [2014-01-02 15:53 UTC] mike@php.net
-Package: PDO +Package: *General Issues
 [2014-01-02 15:53 UTC] mike@php.net
Dupe of closed bug #34909.
 [2014-01-02 15:53 UTC] mike@php.net
-Status: Suspended +Status: Duplicate -Assigned To: helly +Assigned To:
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 21:01:28 2024 UTC