Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CentralNic
rdnsd
Commits
567dfe3f
Unverified
Commit
567dfe3f
authored
Aug 05, 2019
by
Gavin Brown
Browse files
dynamically generate the INSERT statement
parent
de2420dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
567dfe3f
...
...
@@ -96,9 +96,9 @@ has its own syntax for creating tables, only SQLite and MySQL
databases are currently supported (support for other databases
is easy to add, so submit a patch!)
The database will contain a single, which will contain the
The database will contain a single
table
, which will contain the
following columns. The name of the table is determined by the
`DTable`
directive.
`D
B
Table`
directive.
-
`id`
- unique row ID
-
`node_id`
- node ID/hostname
...
...
rdnsd
View file @
567dfe3f
...
...
@@ -402,9 +402,13 @@ sub update_stats {
if
(
$CONF
->
{'
Database
'})
{
$db
=
db_connect
();
$sth
=
$db
->
prepare
(
sprintf
('
INSERT INTO %s
(`node_id`, `start_time`, `end_time`, `host`, `group`, `family`, `proto`, `count`, `success`, `rate`, `min_time`, `time`, `max_time`, `percentile_time`)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
',
$db
->
quote_identifier
(
$CONF
->
{'
DBTable
'})));
my
@cols
=
qw(node_id start_time end_time host group family proto count success rate min_time time max_time percentile_time)
;
$sth
=
$db
->
prepare
(
sprintf
(
'
INSERT INTO %s (%s) VALUES (?%s)
',
$db
->
quote_identifier
(
$CONF
->
{'
DBTable
'}),
join
('
,
',
map
{
$db
->
quote_identifier
(
$_
)
}
@cols
),
('
,?
'
x
(
scalar
(
@cols
)
-
1
))
));
}
my
$fh
;
...
...
@@ -815,9 +819,9 @@ has its own syntax for creating tables, only SQLite and MySQL
databases are currently supported (support for other databases
is easy to add, so submit a patch!)
The database will contain a single, which will contain the
The database will contain a single
table
, which will contain the
following columns. The name of the table is determined by the
C<DTable> directive.
C<D
B
Table> directive.
=over
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment