[Israel.pm] Sorting By MySQL DATETIME Fields?

Gaal Yahas gaal at forum2.org
Wed Jun 16 14:11:12 PDT 2004

On Wed, Jun 16, 2004 at 05:24:07PM +0300, Yuval Yaari wrote:
> I didn't think it's already sortable (and it is: s/[\s:-]/g, then use
> <=> to compare).

Do test cmp too. If your database is mysql then I think (at least some
recent rummaging in the DBD hinted at this) values are PVs anyway, so
this should actually be much faster than s/// + <=>. And it will still
be correct in any case.

(In Pg this not the case. An integer field makes an IV. I think.)

Oh wait, of *course* your values are strings, they contain -s! Then cmp
should simply be faster :)

Gaal Yahas <gaal at forum2.org>

More information about the Perl mailing list