Reply to Re: am I doing unnecessary operations by mysql_fetch_array?

Your name:

Reply:


Posted by Michael Fesser on 08/03/07 17:37

..oO(gosha bine)

>On 03.08.2007 13:06 Michael Fesser wrote:
>>
>> 2) The order in which the fields are returned might not always be the
>> same. If your application depends on that (there are situations where
>> this can be an issue), then it might fail at some time.
>
>If your application depends on that, it shouldn't. Refactor.

Not necessarily. Why do you should list all fields when doing an insert
into a table

INSERT INTO table (field1, field2, ...) VALUES (...)

instead of just doing a

INSERT INTO table VALUES (...)

?

Because order matters, and only the server knows in which order fields
are stored and retrieved. If you use some kind of abstraction layers or
a generic system to access database tables, there can be the situation
where you have to make sure that the returned record set contains the
retrieved fields in the order the processing component expects.
Sometimes you might be able to refactor that, sometimes it might be too
much work. Explicitly listing all columns in the SELECT statement works
always.

Micha

[Back to original 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

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