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
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
USING is bad anyway (Score:1)
I prefer to name my primary key column `id` and use `foo_id` as the name for foreign key columns. Then I use `ON` explicitly.
Overall the query becomes more verbose, but I prefer it that way. It makes my schemata much more easily readable when columns immediately reveal themselves for what they are by their name.
Re: (Score:2)
That still doesn't fix the bug :)
Re: (Score:2)
I don't actually see the bug, yet, but I'm still a little groggy this AM. I do agree with your principle. But you may have to help me along to see this specific bug. :)
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re:USING is bad anyway (Score:2)
You know, this might be a MySQL-specific bug. I don't have other databases handy on which to test this. I tried it in SQLite and the problem doesn't appear:
With MySQL, that SELECT statement was returning data more like this:
As a result, because it was a left join, the duplicated join value was sometimes null and when shoved into a hash, overwrote the original value. However, USING doesn't have this problem in SQLite, but it does with ON:
Reply to This
Parent
Re: (Score:2)
I think it's definitely MySQL specific ... it sounds like MySQL doesn't actually know how to do that type of join properly?
But I'm confused about something else ... I thought selectrow_hashref should give you a hash where the keys are the fieldnames and the values are the values in the record. You seem to be indicating a problem where one of the values is NULL and that gets used as a key in the hash? But I can't see how that would happen, unless I'm misunderstanding the expected results of selectrow_has
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re: (Score:2)
You seem to be indicating a problem where one of the values is NULL and that gets used as a key in the hash?
No, I misunderstood. Never mind. :)
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers