|
Posted by ZeldorBlat on 06/17/07 16:49
On Jun 17, 12:39 pm, webcm...@gmail.com wrote:
> Must I use PDOStatement->setFetchMode() before each fetching data if I
> want to get only or usually ASSOC arrays? Perhaps, not.
You could just try it and find out.
>
> foreach( $stmt as $array ) { ... }
>
> It's the fastest way for fetching records to $array from result. So I
> have to insert $stmt -> setFetchMode(PDO::FETCH_ASSOC) before each
> Foreach.
>
> Simply - lack of PDO->defaultFetchMode(). No one thought about it
> creating PDO. Who can tell PHP or PDO developers about it?
You can. There are plenty of places on the PHP website where you can
request features, report bugs, or just whine about things.
>
> Or:
> PDO->setAttribute(PDO::FETCH, PDO::FETCH_ASSOC);
>
> Why does PDO have constants instead of parameters? Typing PDO::[...]
> isn't so comfortable and I wonder if it isn't slower.
So that PDO constants don't clash with other constants defined in the
global scope. Just because it's uncomfortable for you to type
doesn't make it wrong or incorrect. And I doubt there is any
practical difference in access speed.
Navigation:
[Reply to this message]
|