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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mcka at gmx dot net
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Thu Oct 28 22:03:34 2021 UTC