[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] PHP Guru
- Subject: [ale] PHP Guru
- From: agcarver+ale at acarver.net (Alex Carver)
- Date: Fri, 01 Feb 2013 07:03:30 -0800
- In-reply-to: <[email protected]>
- References: <CAPfJb3pwgRVBmzBn9iOhx7ZkB4XYeBH9DERWsZ3NEcU5PWfbWA@mail.gmail.com> <[email protected]> <CAPfJb3p=CnYp=9Dh+L0jmQ+kCUip_TapU5dveS9N1m9cUMstnQ@mail.gmail.com> <[email protected]> <[email protected]>
On 2/1/2013 01:58, Mike Harrison wrote:
>> still have parentheses and commas in them. This is why I always alias
>> SQL function calls into human readable names if I plan to address the
>> result by name rather than by column number.
>
> Please don't EVER use column numbers, and don't ever use "select *" for
> something in real code. You want to make your database schema and column
> order irrelevant.
>
> And some people in this lists jaws dropped, because they remember when I
> used to do both.
I didn't say I always used them. :P There are uses for column numbers
at very select times. On very rare occasions I use them but for the
most part I use column names. Then again, since all my DB functions are
abstracted, you'd never know whether I was or wasn't using column
numbers. If code is written really well, you shouldn't be able to tell
what I'm using for a database without looking inside the DB abstraction
layer.
I do agree with not using "SELECT *" for a variety of reasons.