Ticket #494 (new Feature Request)
Opened 7 months ago
Suggestions for Database_Result
| Reported by: | HarryR | Owned by: | zombor |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.2 |
| Component: | Libraries:Database | Version: | SVN HEAD |
| Keywords: | pdo,database | Cc: |
Description
One feature that seems to be missing from the Database_Result interface is a portable way to return other formats than just an object or an associative array.
For example, PDO provides additional fetch modes like FETCH_COLUMN, FETCH_KEY and fetching into an arbitrary class of your choice other than stdClass.
Given the statement: SELECT user_id,username,age FROM users WHERE user_id = 3
With FETCH_COLUMN it would return: 3
With FETCH_KEY it would return array( 3 => array('username'=>'example','age'=>101) );
And so on. This is one PDO feature I use daily and saves a hell of a lot of wrapping code to modify arrays into the required format.
What would the method definitions be?
