diff options
author | ivan <ivan> | 2001-09-11 22:20:28 +0000 |
---|---|---|
committer | ivan <ivan> | 2001-09-11 22:20:28 +0000 |
commit | cf7ca698138c8708c68cb969cc843311e385a7a8 (patch) | |
tree | c157eacef4b8974980a404d0cb8c3c70adc07849 /bin/fs-radius-add-reply | |
parent | cb69afd435095144bea83565973561045e28c6a6 (diff) |
fix radius attribute adding
Diffstat (limited to 'bin/fs-radius-add-reply')
-rwxr-xr-x | bin/fs-radius-add-reply | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/bin/fs-radius-add-reply b/bin/fs-radius-add-reply index d2f2e11f0..2f38fbcf7 100755 --- a/bin/fs-radius-add-reply +++ b/bin/fs-radius-add-reply @@ -10,7 +10,7 @@ use FS::raddb; die "Not running uid freeside!" unless checkeuid(); my %attrib2db = - map { $FS::raddb::attrib{lc($_)} => $_ } keys %FS::raddb::attrib; + map { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib; my $user = shift or die &usage; getsecrets($user); @@ -39,14 +39,16 @@ my($char_d) = 80; #default maxlength for text fields ### foreach my $attribute ( @attributes ) { - foreach my $statement ( - "ALTER TABLE svc_acct ADD radius_$attribute varchar($char_d) NULL", -# "ALTER TABLE part_svc ADD svc_acct__radius_$attribute varchar($char_d) NULL;", -# "ALTER TABLE part_svc ADD svc_acct__radius_${attribute}_flag char(1) NULL;", - ) { - $dbh->do( $statement ) or warn "Error executing $statement: ". $dbh->errstr; } + my $statement = + "ALTER TABLE svc_acct ADD COLUMN radius_$attribute varchar($char_d) NULL"; + my $sth = $dbh->prepare( $statement ) + or warn "Error preparing $statement: ". $dbh->errstr; + $sth->execute + or warn "Error executing $statement: ". $sth->errstr; } +$dbh->commit or die $dbh->errstr; + $dbh->disconnect or die $dbh->errstr; print "\n\n", "Now you must run dbdef-create.\n\n"; |