Hey all. So I've searched and searched but haven't been able to find out how to do select conditions as named columns using DBIx::Class. In an attempt to try and keep it simple, here is what I'm looking to do:
SELECT column_name, ( date_column >= NOW() ) as condition FROM some_
+table;
Where I am hunting to have the query return a boolean indicating whether or not 'date_column' is a date past right now. Simple enough it seems. That said, the ultimate question is:
Any ideas of how to do this with DBIx::Class?
Can't seem to find anything in the docs, and have pecked at things like:
{
'select' => { 'date_column' => { '>=', NOW(), } },
}
Which is somewhat similar to how to run within the WHERE tuple condition, yet generates a query like the following (which is not syntactically correct):
SELECT column_name, DATE_COLUMN( >= ( NOW() ) ) as condition
The best part? Even if it did generate the correct syntax, it also decided to uc() the column name. And, given I'm playing with MySQL, my column names are all case sensitive. Boo!
Any help would be appriciated... Even if it's pointing me to documation I missed or skimmed to fast.
Thanks!
---------
perl -le '$.=[qw(104 97 124 124 116 97)];*p=sub{[@{$_[0]},(45)x 2]};*d=sub{[(45)x 2,@{$_[0]}]};print map{chr}@{p(d($.))}'
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.