Hey all...

I think I've found a stumbling block for myself, but I'd like to find out if there's something I don't know before I start making lots of changes.

We recently changed column names to a shorter format, and in most of our code we are currently using a "table.column" format.

I have been a big fan of fetchrow_hashref for a while, and so I've used it in many, many, many places.

So now, when I get my hash back, the keys look like this:

"address_1" "city" "state"

...when I need them to look like this:

"address.address_1" "address.city" "address.state"

The two changes I am considering are to: 1)use a fetchrow_array, and list my values out; or 2)use " AS " in my SELECT statements. I hate both options.

Is there a way to tell MySQL and/or the DBI that I want the table.column format in my hash keys?

There is another question out there that is similar to mine, but the answer wasn't what I was looking for, and I just want to know if there is a better solution for me.

Here is that link:

How do I get "table.column" format from a select/join?

Thanks so much,
Dale


In reply to fetchrow_hashref, and table.column format by bigperm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.