
On 2006-10-07, Nicola Musatti <Nicola.Musatti@gmail.com> wrote:
Peter Dimov wrote:
Nicola Musatti wrote:
On the other hand if I'm using a dynamic representation that only relies on a limited subset of the fields involved in the query I'd use '*' so as to limit the conditions that could break my code. In similar cases I wouldn't rely on field order but rather on matching by name.
Why not simply select the limited subset on which you rely?
You're right. Actually the only case where it's meaningful to use 'select *' is when you don't know which columns you're looking for or you don't care. That is, you're either exploring the data or writing a context independent tool.
Well, back to Jeff's point about how it would be nice if the specification of the column names in the query was somehow validated against the the column names in the o/r mapping at compile time, to find any disconnects. It's an interesting idea (might require full SQL parser to achieve?) What I was trying to point out is that the use of select * and name based mapping is one way to eliminate the posibility of such disconnects. Steve