The fetch_style used when fetching rows is not amendable.
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 4.5k
- Forks
- 884
- PR merge metrics
- No merged PRs in 30d
Description
For me, I would normally use PDO::FETCH_ASSOC, but currently it is PDO::FETCH_BOTH which results in the result containing both numeric and associative indices.
I'm happy to do the work on this, but would like some suggestions on what a suitable solution would be.
Mine would be to add a new element to the PdoAdapter::$options array called (maybe) default_fetch_style with a default value of the current default value of PDO::FETCH_BOTH.
The default could be overridden by a new PdoAdapter:::setOption($option, $value) method which would set a single option. It would validate the value if the option is default_fetch_style and throw an exception if an inappropriate value is supplied.
Each call to any method in the PdoAdapter that is currently using the default of PDO::FETCH_BOTH would be switched to use PdoAdapater::getOption('default_fetch_style').
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting PdoAdapter and locating each row-fetching call that currently relies on PDO::FETCH_BOTH. Review the proposed option and setter approach, then confirm that the default remains unchanged while callers can select PDO::FETCH_ASSOC and invalid styles are rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- database
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100