Re: RFC:: DateTime::Span::Common

[email protected] (Dave Rolsky)
Newsgroups perl.datetime
Message-ID <[email protected]>
On Tue, 7 Apr 2009, Terrence Brannon wrote:

> Yes, I would determine that aribtrary 1 second or nanosecond based on
> the data in my database tables. a MySQL BETWEEN clause includes its
> endpoints.

Unfortunately, BETWEEN is kind of broken.

What people generally want is:

  $x <= Column < $y

But unfortunately BETWEEN gives you:

  $x <= Column <= $y

Your solution, to subtract from $y, is not a good idea, since it's extra 
code which could break, and the math confuses the issue, which is that you 
really meant to write the first comparison.

So just suck it up and write:

   WHERE col >= ?
     AND col < ?


-dave

/*============================================================
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
============================================================*/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.