Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • This isn't necessarily anything wrong with using SELECT *, relying on the order of columns returned is the problem.

    I remember reading somebody saying that you should always use an ORDER BY clause in SQL, which is useless in the cases where order doesn't matter.

    Sometimes order does matter, sometimes it doesn't, it's about using the right tool for the job.
    • This guy's absolutely right. You shouldn't be depending on the order of the columns returned, you should address the values by the columns. There's different ways to do that: named bind variables, returning each row as a hash keyed by its column, etc.
    • I know that I've said results returned should always use "ORDER BY" and I was (again) being stupid. I was pissed off at a programmer failing to sort his results properly and when I get annoyed, I say stupid things.

      In that case, the programmer eventually sorted the data, in Perl. That's usually stupid when the database can handle it. In our case it resulted in a bug whereby the data always had to be sorted but sometimes we were getting it before it had been sorted. The problem (and this is merlyn's poi