+ my $cdrid = ($1-1900). $2; #2009 -> 109 so we fit in a bigint
+
+ unless ( $cdrs ) { #inefficient
+ my $dsth = dbh->prepare(
+ 'SELECT cdrid FROM cdr WHERE cdrid IS NOT NULL AND cdrid = ?'
+ ) or die dbh->errstr;
+ $dsth->execute($cdrid) or die $dsth->errstr;
+ my $row = $dsth->fetchrow_arrayref;
+ if ( $row && $row->[0] eq $cdrid ) { # == w/ 8 byte int?
+ warn "$cdrid (dup)\n" if $DEBUG > 1;
+ next;
+ }
+ }
+ warn "$cdrid\n" if $DEBUG > 1;