php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34714 set Default Fetch Mode in PDO class
Submitted: 2005-10-03 11:12 UTC Modified: 2017-03-29 12:42 UTC
Votes:5
Avg. Score:4.0 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: mcka at gmx dot net Assigned: tpunt (profile)
Status: Closed Package: PDO related
PHP Version: 5.1.0RC1 OS: *
Private report: No CVE-ID: None
 [2005-10-03 11:12 UTC] mcka at gmx dot net
Description:
------------
If you have a lot of queries in a script and you don't want to use the default PDO::FETCH_BOTH Mode (which returns an array with numbers and col-name indexes) - perhaps you want do use PDO::FETCH_OBJ or PDO::FETCH_ASSOC... - you have to set the fetch mode again and again for every query/statement.

If there would be something like:

PDO::setDefaultFetchMode()

or

PDO::setAttribute(PDO::DEFAULT_FETCH_MODE...)

you could set the fetch mode once in the script.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-08 21:46 UTC] jani@php.net
-Package: Feature/Change Request +Package: PDO related
 [2017-03-29 12:42 UTC] tpunt@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: tpunt
 [2017-03-29 12:42 UTC] tpunt@php.net
This was implemented soon after this report was opened. See the ATTR_DEFAULT_FETCH_MODE constant on the PDO::setAttribute() manual page[1].

[1]: http://php.net/manual/en/pdo.setattribute.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 12:01:30 2024 UTC