=head1 CLASS METHODS
-=item do_cli_import
+=item dbi_import
=cut
# )
#my @cols = values %{ $args{column_map} };
- my $sql = "SELECT * FROM $table "; # join(',', @cols). " FROM $table ".
+ my $sql = "SELECT $table.* FROM $table "; # join(',', @cols). " FROM $table ".
$sql .= 'LEFT JOIN '. $args{status_table}.
- ' USING ( '. $args{primary_key}. ' )'
+ " ON ( $table.$pkey = ". $args{status_table}. ".$pkey )"
if $args{status_table};
$sql .= ' WHERE freesidestatus IS NULL ';
$cdr->cdrtypenum($opt{c}) if $opt{c};
- #print $row->{$pkey},"\n" if $opt{v};
+ my $pkey_value = $row->{$pkey};
+
+ #print "$pkey_value\n" if $opt{v};
my $error = $cdr->insert;
if ($error) {
- #die $row->{$pkey} . ": failed import: $error\n";
- print $row->{$pkey} . ": failed import: $error\n";
+ #die "$pkey_value: failed import: $error\n";
+ print "$pkey_value: failed import: $error\n";
} else {
}
- my $updated = $dbi->do($st_sql, undef, $row->{$pkey} );
+ my $updated = $dbi->do($st_sql, undef, $pkey_value );
#$updates += $updated;
die "failed to set status: ".$dbi->errstr."\n" unless $updated;