- if ( $sth_alter && $sth_alter->execute ) {
- my $sth_update = $dbh->prepare(
- "UPDATE radacct SET FreesideStatus = 'done' WHERE FreesideStatus IS NULL"
- ) or die $dbh->errstr;
- $sth_update->execute or die $sth_update->errstr;
+ if ( $sth_alter ) {
+ if ( $sth_alter->execute ) {
+ my $sth_update = $dbh->prepare(
+ "UPDATE radacct SET FreesideStatus = 'done' WHERE FreesideStatus IS NULL"
+ ) or die $errmsg.$dbh->errstr;
+ $sth_update->execute or die $errmsg.$sth_update->errstr;
+ } else {
+ my $error = $sth_alter->errstr;
+ warn $errmsg.$error unless $error =~ /Duplicate column name/i;
+ }
+ } else {
+ my $error = $dbh->errstr;
+ warn $errmsg.$error; #unless $error =~ /exists/i;