diff options
author | mark <mark> | 2010-11-04 05:57:00 +0000 |
---|---|---|
committer | mark <mark> | 2010-11-04 05:57:00 +0000 |
commit | bd35baff8b7b5dcdd44d14a1139ef4d48009274c (patch) | |
tree | a727a7ef414a242fad7ddb3cd1eda6533f97f14b /FS/FS | |
parent | 2ecef68b926eae756524a564bd0986da7b56109f (diff) |
clean up postgres-isms, RT#10324
Diffstat (limited to 'FS/FS')
-rw-r--r-- | FS/FS/cust_main/Search.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index b9a30a552..ac170ff1f 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -541,11 +541,13 @@ sub search { "cust_main.$field >= $beginning", "cust_main.$field <= $ending"; - # XXX: do this for mysql and/or pull it out of here if(defined $hour) { - if ($dbh->{Driver}->{Name} eq 'Pg') { + if ($dbh->{Driver}->{Name} =~ /Pg/i) { push @where, "extract(hour from to_timestamp(cust_main.$field)) = $hour"; } + elsif( $dbh->{Driver}->{Name} =~ /mysql/i) { + push @where, "hour(from_unixtime(cust_main.$field)) = $hour" + } else { warn "search by time of day not supported on ".$dbh->{Driver}->{Name}." databases"; } |