Skip to content

Commit dcef987

Browse files
authored
A DB Exec Failed!, Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use (Cacti#6217)
* Fix Error: You have an error in your SQL syntax due to using table field without backtick. -issue#6210: Fix Error: You have an error in your SQL syntax due to using table field without backtick. * -issue#6210: Fix Error: You have an error in your SQL syntax due to using table field without backtick. -issue#6210: Fix Error: You have an error in your SQL syntax due to using table field without backtick. A DB Exec Failed!, Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'function, status) VALUES ('1', 'internal', 'config_arrays', '', 'plugin_config_a' at line 1 A DB Exec Failed!, Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'function, status) VALUES ('1', 'internal', 'config_arrays', '', 'plugin_config_a' at line 1
1 parent f8c3348 commit dcef987

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Cacti CHANGELOG
22

33
1.2.31
4+
-issue#6210: Fix Error: You have an error in your SQL syntax due to using table field without backtick.
45
-issue#6202: Adding devices via automation fails
56

67
1.2.30

lib/poller.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,11 +1856,11 @@ function replicate_out_table($conn, &$data, $table, $remote_poller_id, $truncate
18561856
foreach($cols as $col) {
18571857
if ($exclude !== false) {
18581858
if (array_search($col, $exclude) === false) {
1859-
$suffix .= ($i > 0 ? ', ':'') . " $col=VALUES($col)";
1859+
$suffix .= ($i > 0 ? ', ':'') . " `$col`=VALUES($col)";
18601860
$i++;
18611861
}
18621862
} else {
1863-
$suffix .= ($i > 0 ? ', ':'') . " $col=VALUES($col)";
1863+
$suffix .= ($i > 0 ? ', ':'') . " `$col`=VALUES($col)";
18641864
$i++;
18651865
}
18661866
}
@@ -1877,7 +1877,7 @@ function replicate_out_table($conn, &$data, $table, $remote_poller_id, $truncate
18771877
if (!db_column_exists($table, $c, false, $conn)) {
18781878
$skipcols[$index] = $c;
18791879
} else {
1880-
$prefix .= ($colcnt > 0 ? ', ':'') . $c;
1880+
$prefix .= ($colcnt > 0 ? ', ':'') . `$c`;
18811881
$colcnt++;
18821882
}
18831883
}

0 commit comments

Comments
 (0)