use FS::UID qw(adminsuidsetup dbh);
use FS::Log;
use FS::cdr;
-use DBI;
+use FS::DBI;
use Getopt::Std;
$DEBUG = 0;
my $log = FS::Log->new( 'freeside-cdr-asterisk_sql' );
-my $dbi = DBI->connect($dsn, $opt{U}, $opt{P}) ;
+my $dbi = FS::DBI->connect($dsn, $opt{U}, $opt{P}) ;
if ( $dbi ) {
log_msg( info => "Established connection to CDR database at dsn($dsn)" );
log_and_die( error =>
sprintf 'Fatal error connecting to CDR database at dsn(%s): %s',
$dsn,
- $DBI::errstr
+ $FS::DBI::errstr
);
}
my @cols = ();
if ( $opt{V} >= 12 ) {
- push @cols, qw( id start answer end );
+ push @cols, qw( id start answer );
+ if ( $engine =~ /^Pg/ ) {
+ push @cols, "'end'";
+ } else {
+ push @cols, "end";
+ }
} else {
push @cols, qw( calldate );
}
sub usage {
- "Usage: \n freeside-cdr-asterisk_sql\n\t-e mysql|Pg|... [ -H host ]n\t-D database\n\t[ -T table ]\n\t[ -V asterisk_version]\n\t-U user\n\t-P password\n\tfreesideuser\n";
+ "Usage: \n freeside-cdr-asterisk_sql\n\t-e mysql|Pg|... [ -H host ]\n\t-D database\n\t[ -T table ]\n\t[ -V asterisk_version]\n\t-U user\n\t-P password\n\tfreesideuser\n";
}
=head1 NAME