Merge pull request #76 from JackSlateur/fix-68

Escape sqlite's tablenames
This commit is contained in:
Manuel Kasper 2018-08-06 09:17:22 +02:00 committed by GitHub
commit 0dbec1cd8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -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 .= ');';

View File

@ -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";