mirror of
https://github.com/manuelkasper/AS-Stats.git
synced 2025-02-20 11:44:12 +08:00
Merge pull request #76 from JackSlateur/fix-68
Escape sqlite's tablenames
This commit is contained in:
commit
0dbec1cd8e
@ -51,9 +51,9 @@ foreach my $rrdfile (@rrdfiles) {
|
||||
}
|
||||
print "\n";
|
||||
|
||||
my $query = 'create table stats(asn int';
|
||||
my $query = 'create table stats("asn" int';
|
||||
foreach my $link (@links) {
|
||||
$query .= ", ${link}_in int, ${link}_out int, ${link}_v6_in int, ${link}_v6_out int";
|
||||
$query .= ", \"${link}_in\" int, \"${link}_out\" int, \"${link}_v6_in\" int, \"${link}_v6_out\" int";
|
||||
}
|
||||
$query .= ');';
|
||||
|
||||
|
@ -112,9 +112,9 @@ function getasstats_top($ntop, $statfile, $selected_links) {
|
||||
$query_total = '0';
|
||||
$query_links = '';
|
||||
foreach($selected_links as $tag){
|
||||
$query_links .= "${tag}_in, ${tag}_out, ${tag}_v6_in, ${tag}_v6_out, ";
|
||||
$query_links .= "\"${tag}_in\", \"${tag}_out\", \"${tag}_v6_in\", \"${tag}_v6_out\", ";
|
||||
$nlinks += 4;
|
||||
$query_total .= " + ${tag}_in + ${tag}_out + ${tag}_v6_in + ${tag}_v6_out";
|
||||
$query_total .= " + \"${tag}_in\" + \"${tag}_out\" + \"${tag}_v6_in\" + \"${tag}_v6_out\"";
|
||||
}
|
||||
$query = "select asn, $query_links $query_total as total from stats order by total desc limit $ntop";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user