- my @records;
- my $dbh = dbh;
- if ( $dbh->{Driver}->{Name} eq 'Pg' ) {
- @records = qsearch({
- 'table' => 'srvexport',
- 'select' => "*, date_part('epoch',to_timestamp(srv_date||' '||srv_time,'YYYY-MM-DD HH:MI:SS')) as _date",
- 'extra_sql' => "where serviceid in $serviceid_sql and
- date_part('epoch',to_timestamp(srv_date||' '||srv_time,'YYYY-MM-DD HH:MI:SS')) >= $start
- and date_part('epoch',to_timestamp(srv_date||' '||srv_time,'YYYY-MM-DD HH:MI:SS')) <= $end",
- 'order_by' => "order by date_part('epoch',to_timestamp(srv_date||' '||srv_time,'YYYY-MM-DD HH:MI:SS')) asc",
- });
- } elsif ( $dbh->{Driver}->{Name} eq 'mysql' ) {
- @records = qsearch({
- 'table' => 'srvexport',
- 'select' => "*, unix_timestamp(srv_date||' '||srv_time) as _date",
- 'extra_sql' => "where serviceid in $serviceid_sql and
- unix_timestamp(srv_date||' '||srv_time) >= $start
- and unix_timestamp(srv_date||' '||srv_time) <= $end",
- 'order_by' => "order by unix_timestamp(srv_date||' '||srv_time) asc",
- });
- } else {
- return 'Unsupported DBMS';
- }
-
- #my $_date = str2time_sql. "srv_date||' '||srv_time".
- # str2time_sql_closing;
-
- #my @records = qsearch({
- # 'table' => 'srvexport',
- # 'select' => "*, $_date as _date",
- # 'extra_sql' => "where serviceid in $serviceid_sql
- # and $_date >= $start
- # and $_date <= $end",
- # 'order_by' => "order by $_date asc",
- #});
+ local($FS::Record::nowarn_classload) = 1;
+ my @records = qsearch({
+ 'table' => 'srvexport',
+ 'select' => "*, $_date as _date",
+ 'extra_sql' => "where serviceid in $serviceid_sql
+ and $_date >= $start
+ and $_date <= $end",
+ 'order_by' => "order by $_date asc",
+ });