I don't quite see the problem. The code that converts +1 month into SQL knows that it is producing SQL at that point, so you can set it up to either produce SQL or produce a quoted date string. What am I missing? You need to post some actual code for your real problem to become obvious.
Hard to post code that will explain the problem, as the SQL is all generated dynamically with a bunch of crufty addons to a slice of nasty legacy code :-)

The key is that I'm using placeholders, and when I pass something like 'DATE(NOW() + INTERVAL '1 month')' via a placeholder, it gets quoted as a string, and it doesn't work.

I beleive that's the bit you're missing :-)

As others have mentioned, I can either not use placeholders (bad, IMHO) or do the date maniplulations in perl rather than in SQL. A third option is to do an extra 'SELECT' of my own to deduce the actual modified date.

I've decided to hold off on it for a while. It wasn't a key feature, and I mainly wanted it because (I thought) implementation would be easy and the details could be left to SQL. If the user typed in a b0rked date interval, it would just raise an SQL exception.


In reply to Re: Re: DBI quoting when I don't want it to by Tardis
in thread DBI quoting when I don't want it to by Tardis

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.