summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2018-09-24 13:44:01 -0400
committerChristopher Burger <burgerc@freeside.biz>2018-09-24 19:20:24 -0400
commitb932d7d067c6f3d917f9da3efe6b9ab7fd23ab8e (patch)
tree7a9ec53da492b4ec20646a04f3023b9f4fe8b830
parent95e61b65bcf59209181fec43d760210a3846ce26 (diff)
RT# 80511 - fixed error with sybase db connection
Conflicts: FS/FS/cdr/Import.pm
-rw-r--r--FS/FS/cdr/Import.pm21
1 files changed, 6 insertions, 15 deletions
diff --git a/FS/FS/cdr/Import.pm b/FS/FS/cdr/Import.pm
index 86a1a86..7944e5b 100644
--- a/FS/FS/cdr/Import.pm
+++ b/FS/FS/cdr/Import.pm
@@ -60,6 +60,8 @@ sub dbi_import {
my $dbd_type = $args{'dbd'} ? $args{'dbd'} : 'Pg';
my $status_column = $args{status_column} ? $args{status_column} : 'freesidestatus';
my $status_column_info = $args{status_column_info} ? $args{status_column} : 'VARCHAR(32)';
+ my $st_sql;
+ my $batch_name = $args{batch_name} ? $args{batch_name} : 'CDR_DB';
my $queries = get_queries({
'dbd' => $dbd_type,
@@ -88,6 +90,7 @@ sub dbi_import {
$dbi->do( $queries->{create_statustable} )
or die $dbi->errstr;
}
+ $st_sql = "INSERT INTO $status_table ( $pkey, $status_column ) VALUES ( ?, 'done' )";
}
## check for column freeside status if not using status table and create it if not there.
else {
@@ -97,6 +100,7 @@ sub dbi_import {
$dbi->do( $queries->{create_statuscolumn} )
or die $dbi->errstr;
}
+ $st_sql = "UPDATE $table SET $status_column = 'done' WHERE $pkey = ?";
}
#my @cols = values %{ $args{column_map} };
@@ -110,7 +114,7 @@ sub dbi_import {
$sth->execute or die $sth->errstr. " executing $sql";
my $cdr_batch = new FS::cdr_batch({
- 'cdrbatch' => $args{batch_name} . '-import-'. time2str('%Y/%m/%d-%T',time),
+ 'cdrbatch' => $batch_name . '-import-'. time2str('%Y/%m/%d-%T',time),
});
my $error = $cdr_batch->insert;
die $error if $error;
@@ -149,19 +153,6 @@ sub dbi_import {
$imported++;
- my $st_sql;
- if ( $args{status_table} ) {
-
- $st_sql =
- 'INSERT INTO '. $status_table. " ( $pkey, $status_column ) ".
- " VALUES ( ?, 'done' )";
-
- } else {
-
- $st_sql = "UPDATE $table SET $status_column = 'done' WHERE $pkey = ?";
-
- }
-
my $updated = $dbi->do($st_sql, undef, $pkey_value );
#$updates += $updated;
die "failed to set status: ".$dbi->errstr."\n" unless $updated;
@@ -195,7 +186,7 @@ sub get_queries {
$port ||= '5000'; # check for pg default 5000 is sybase.
my %dbi_connect_types = (
- 'Sybase' => ':host='.$host.';port='.$port,
+ 'Sybase' => ':server='.$host.';port='.$port,
'Pg' => ':host='.$info->{host},
);