+
+my @cols = (qw(
+ calldate clid src dst dcontext channel lastapp lastdata duration
+ billsec disposition amaflags accountcode userfield
+));
+
+# check for existence of uniqueid
+if ( $engine =~ /^mysql/ ) {
+ my $status = $dbi->selectall_arrayref("SHOW COLUMNS FROM $table WHERE Field = 'uniqueid'");
+ if( @$status ) {
+ push @cols, 'uniqueid';
+ }
+} else {
+ #assume there's a uniqueid
+ push @cols, 'uniqueid';