[patch] PDO_FETCH_KEYS
| From: | Hans-Peter Oeri | Date: | Sat, 24 Nov 2007 21:31:30 +0000 |
| Subject: | [patch] PDO_FETCH_KEYS | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-33418@lists.php.net to get a copy of this message | ||
Hi!
I discovered that PDO::FETCH_KEY_PAIR does not work as documented.
Documented is:
'Fetch into an array where the 1st column is a key and all subsequent
columns are values'
Actually, all but two column result sets throw an error...
Then I thought about generalizing the fetch mode. Have 1..n 'key'
columns. If only one value is left, assign it as a scalar. If multiple
columns are left over, have it taken as FETCH_ASSOC.
Please find attached a humble suggestion to generalize FETCH_KEY_PAIR to
FETCH_KEYS, including an attribute to define the number of 'key' columns
(defaults to one).
The result should be fully backwards compatible.
Please give me your suggestions.
HPO
PS: My diff includes my 'old' FETCH_2D patch.