~yolanda.robla/ubuntu/saucy/freeradius/dep-8-tests

« back to all changes in this revision

Viewing changes to dialup_admin/bin/tot_stats

  • Committer: Bazaar Package Importer
  • Author(s): Josip Rodin
  • Date: 2009-11-23 03:57:37 UTC
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20091123035737-snauioz5r9tf8sdr
Tags: upstream-2.1.7+dfsg
ImportĀ upstreamĀ versionĀ 2.1.7+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/perl
2
2
use POSIX;
 
3
use File::Temp;
3
4
 
4
5
# Log in the totacct table aggregated daily accounting information for
5
6
# each user.
48
49
        AcctStopTime < '$date_end' GROUP BY UserName,NASIPAddress;";
49
50
print "$query1\n";
50
51
print "$query2\n";
51
 
open TMP, ">/tmp/tot_stats.query"
52
 
        or die "Could not open tmp file\n";
53
 
print TMP "ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT='YYYY-MM-DD HH24:MI:SS.FF TZH:TZM';\n" if ($sql_type eq 'oracle');
54
 
print TMP $query1;
55
 
print TMP $query2;
56
 
close TMP;
57
 
$command = "$sqlcmd -h $sql_server -u $sql_username $sql_password $sql_database </tmp/tot_stats.query" if ($sql_type eq 'mysql');
58
 
$command = "$sqlcmd  -U $sql_username -f /tmp/tot_stats.query $sql_database" if ($sql_type eq 'pg');
 
52
my ($fh, $tmp_filename) = tempfile() or die "Could not open tmp file\n";
 
53
print $fh "ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT='YYYY-MM-DD HH24:MI:SS.FF TZH:TZM';\n" if ($sql_type eq 'oracle');
 
54
print $fh $query1;
 
55
print $fh $query2;
 
56
close $fh;
 
57
$command = "$sqlcmd -h $sql_server -u $sql_username $sql_password $sql_database < $tmp_filename" if ($sql_type eq 'mysql');
 
58
$command = "$sqlcmd  -U $sql_username -f  $tmp_filename $sql_database" if ($sql_type eq 'pg');
59
59
$command = "$sqlcmd  $sql_username/$pass" . "@" . "$sql_database <$tmpfile.$server" if ($sql_type eq 'oracle');
60
 
$command = "$sqlcmd '$sql_server' '$sql_port' '' '$sql_username' '$sql_password' </tmp/tot_stats.query" if ($sql_type eq 'sqlrelay');
 
60
$command = "$sqlcmd '$sql_server' '$sql_port' '' '$sql_username' '$sql_password' < $tmp_filename" if ($sql_type eq 'sqlrelay');
61
61
`$command`;