mirror of
https://github.com/manuelkasper/AS-Stats.git
synced 2025-02-20 11:44:12 +08:00
Escape sqlite's tablenames
Fix https://github.com/manuelkasper/AS-Stats/issues/68 This is a commit from https://github.com/falz, thanks to him Signed-off-by: Alexandre Bruyelles <git@jack.fr.eu.org>
This commit is contained in:
parent
761520b725
commit
b741f6704c
@ -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