AuditEntryCollection
MySqlConfigBackendDHCPv4::
-getRecentAuditEntries4(const db::ServerSelector&,
+getRecentAuditEntries4(const db::ServerSelector& server_selector,
const boost::posix_time::ptime& modification_time) const {
AuditEntryCollection audit_entries;
impl_->getRecentAuditEntries(MySqlConfigBackendDHCPv4Impl::GET_AUDIT_ENTRIES4_TIME,
- modification_time, audit_entries);
+ server_selector, modification_time, audit_entries);
return (audit_entries);
}
void
MySqlConfigBackendImpl::getRecentAuditEntries(const int index,
+ const db::ServerSelector& server_selector,
const boost::posix_time::ptime& modification_time,
AuditEntryCollection& audit_entries) {
// Create the output bindings for receiving the data.
MySqlBinding::createString(AUDIT_ENTRY_LOG_MESSAGE_BUF_LENGTH)
};
- // There is only one input binding, modification time.
- MySqlBindingCollection in_bindings = {
- MySqlBinding::createTimestamp(modification_time)
- };
-
- // Execute select.
- conn_.selectQuery(index, in_bindings, out_bindings,
- [&audit_entries] (MySqlBindingCollection& out_bindings) {
- // Convert the numeric modification type into modification type enum.
- AuditEntry::ModificationType mod_type =
- static_cast<AuditEntry::ModificationType>(out_bindings[3]->getInteger<uint8_t>());
-
- // Create new audit entry and add it to the collection of received
- // entries.
- AuditEntryPtr audit_entry(new AuditEntry(out_bindings[1]->getString(),
- out_bindings[2]->getInteger<uint64_t>(),
- mod_type,
- out_bindings[4]->getTimestamp(),
- out_bindings[5]->getStringOrDefault("")));
- audit_entries.insert(audit_entry);
- });
+ auto tags = getServerTags(server_selector);
+
+ for (auto tag : tags) {
+
+ // There is only one input binding, modification time.
+ MySqlBindingCollection in_bindings = {
+ MySqlBinding::createString(tag),
+ MySqlBinding::createTimestamp(modification_time)
+ };
+
+ // Execute select.
+ conn_.selectQuery(index, in_bindings, out_bindings,
+ [&audit_entries] (MySqlBindingCollection& out_bindings) {
+ // Convert the numeric modification type into modification type enum.
+ AuditEntry::ModificationType mod_type =
+ static_cast<AuditEntry::ModificationType>(out_bindings[3]->getInteger<uint8_t>());
+
+ // Create new audit entry and add it to the collection of received
+ // entries.
+ AuditEntryPtr audit_entry(new AuditEntry(out_bindings[1]->getString(),
+ out_bindings[2]->getInteger<uint64_t>(),
+ mod_type,
+ out_bindings[4]->getTimestamp(),
+ out_bindings[5]->getStringOrDefault("")));
+ audit_entries.insert(audit_entry);
+ });
+ }
}
uint64_t
/// @brief Sends query to the database to retrieve most recent audit entries.
///
/// @param index Index of the query to be used.
+ /// @param server_selector Server selector.
/// @param modification_time Timestamp being a lower limit for the returned
/// result set, i.e. entries later than specified time are returned.
/// @param [out] audit_entries Reference to the container where fetched audit
/// entries will be inserted.
void getRecentAuditEntries(const int index,
+ const db::ServerSelector& server_selector,
const boost::posix_time::ptime& modification_time,
db::AuditEntryCollection& audit_entries);