You are here: Re: PDO - setFetchMode() before each getting? « PHP Programming Language « IT news, forums, messages
Re: PDO - setFetchMode() before each getting?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация