|
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]
|