diff options
author | Kristian Lyngstol <kly@kly@.no> | 2016-03-22 13:04:37 +0100 |
---|---|---|
committer | Kristian Lyngstol <kly@kly@.no> | 2016-03-22 13:04:37 +0100 |
commit | a8f122dfef27846895805df4db0fd1efb2f715ee (patch) | |
tree | c55add30097e26d38fcf0f2d56c4667c5be578d1 /web/nms.gathering.org/api/read/comments | |
parent | ef480bf237b88e667ff525a1dfb881cb8bd7cf0a (diff) | |
parent | 490560f31c20dd8191ee1a0f8f6e90b2820d7c77 (diff) |
Merge branch 'master' of github.com:tech-server/tgmanage
Diffstat (limited to 'web/nms.gathering.org/api/read/comments')
-rwxr-xr-x | web/nms.gathering.org/api/read/comments | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/web/nms.gathering.org/api/read/comments b/web/nms.gathering.org/api/read/comments new file mode 100755 index 0000000..4adfb2b --- /dev/null +++ b/web/nms.gathering.org/api/read/comments @@ -0,0 +1,15 @@ +#! /usr/bin/perl +# vim:ts=8:sw=8 + +use lib '../../../../include'; +use nms::web; +use strict; +use warnings; + +my $query = $nms::web::dbh->prepare('select sysname,extract(epoch from date_trunc(\'second\',time)) as time,state,username,id,comment from switch_comments natural join switches where state != \'delete\' order by time desc'); +$query->execute(); +while (my $ref = $query->fetchrow_hashref()) { + push @{$nms::web::json{'comments'}{$ref->{'sysname'}}{'comments'}},$ref; +} + +nms::web::finalize_output(); |