} catch (const DuplicateEntry&) {
deletePools4(subnet);
- deleteOptions4(existing_subnet);
+ deleteOptions4(subnet);
// Need to add one more binding for WHERE clause.
in_bindings.push_back(MySqlBinding::createInteger<uint32_t>(subnet->getID()));
// (Re)create pools.
for (auto pool : subnet->getPools(Lease::TYPE_V4)) {
- createPool4(selector, boost::dynamic_pointer_cast<Pool4>(pool), subnet);
+ createPool4(server_selector, boost::dynamic_pointer_cast<Pool4>(pool),
+ subnet);
}
// (Re)create options.
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy(new OptionDescriptor(*desc));
desc_copy->space_name_ = option_space;
- createUpdateOption4(selector, subnet->getID(), desc_copy);
+ createUpdateOption4(server_selector, subnet->getID(), desc_copy);
}
}
for (auto desc = options->begin(); desc != options->end(); ++desc) {
OptionDescriptorPtr desc_copy(new OptionDescriptor(*desc));
desc_copy->space_name_ = option_space;
- createUpdateOption4(selector, shared_network->getName(), desc_copy);
+ createUpdateOption4(server_selector, shared_network->getName(),
+ desc_copy);
}
}
/// @param name Option name.
/// @return Number of deleted option definitions.
uint64_t deleteOptionDef4(const ServerSelector& /* server_selector */,
- const uint16_t code,
- const std::string& space) {
+ const uint16_t code,
+ const std::string& space) {
MySqlBindingCollection in_bindings = {
MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(code)),
MySqlBinding::createString(space)
/// @param selector Server selector.
/// @param code Code of the deleted option.
/// @param space Option space of the deleted option.
- void deleteOption4(const db::ServerSelector& /* selector */,
- const uint16_t code,
- const std::string& space) {
+ /// @return Number of deleted options.
+ uint64_t deleteOption4(const ServerSelector& /* selector */,
+ const uint16_t code,
+ const std::string& space) {
MySqlBindingCollection in_bindings = {
MySqlBinding::createInteger<uint8_t>(code),
MySqlBinding::createString(space)
};
// Run DELETE.
- conn_.updateDeleteQuery(DELETE_OPTION4, in_bindings);
+ return (conn_.updateDeleteQuery(DELETE_OPTION4, in_bindings));
}
/// @brief Deletes subnet level option.
/// belongs.
/// @param code Code of the deleted option.
/// @param space Option space of the deleted option.
- void deleteOption4(const db::ServerSelector& /* selector */,
- const SubnetID& subnet_id,
- const uint16_t code,
- const std::string& space) {
+ /// @return Number of deleted options.
+ uint64_t deleteOption4(const ServerSelector& /* selector */,
+ const SubnetID& subnet_id,
+ const uint16_t code,
+ const std::string& space) {
MySqlBindingCollection in_bindings = {
MySqlBinding::createInteger<uint32_t>(static_cast<uint32_t>(subnet_id)),
MySqlBinding::createInteger<uint8_t>(code),
};
// Run DELETE.
- conn_.updateDeleteQuery(DELETE_OPTION4_SUBNET_ID, in_bindings);
+ return (conn_.updateDeleteQuery(DELETE_OPTION4_SUBNET_ID, in_bindings));
}
/// @brief Deletes pool level option.
/// @param pool_end_address Upper bound pool address.
/// @param code Code of the deleted option.
/// @param space Option space of the deleted option.
- void deleteOption4(const db::ServerSelector& /* selector */,
- const IOAddress& pool_start_address,
- const IOAddress& pool_end_address,
- const uint16_t code,
- const std::string& space) {
+ /// @return Number of deleted options.
+ uint64_t deleteOption4(const db::ServerSelector& /* selector */,
+ const IOAddress& pool_start_address,
+ const IOAddress& pool_end_address,
+ const uint16_t code,
+ const std::string& space) {
MySqlBindingCollection in_bindings = {
MySqlBinding::createInteger<uint32_t>(pool_start_address.toUint32()),
MySqlBinding::createInteger<uint32_t>(pool_end_address.toUint32()),
};
// Run DELETE.
- conn_.updateDeleteQuery(DELETE_OPTION4_POOL_RANGE, in_bindings);
+ return (conn_.updateDeleteQuery(DELETE_OPTION4_POOL_RANGE,
+ in_bindings));
}
/// @brief Deletes shared network level option.
/// option belongs to
/// @param code Code of the deleted option.
/// @param space Option space of the deleted option.
- void deleteOption4(const db::ServerSelector& /* selector */,
+ /// @return Number of deleted options.
+ uint64_t deleteOption4(const db::ServerSelector& /* selector */,
const std::string& shared_network_name,
const uint16_t code,
const std::string& space) {
};
// Run DELETE.
- conn_.updateDeleteQuery(DELETE_OPTION4_SHARED_NETWORK, in_bindings);
+ return (conn_.updateDeleteQuery(DELETE_OPTION4_SHARED_NETWORK,
+ in_bindings));
}
/// @brief Deletes options belonging to a subnet from the database.
///
/// @param subnet Pointer to the subnet for which options should be
/// deleted.
- void deleteOptions4(const Subnet4Ptr& subnet) {
+ /// @return Number of deleted options.
+ uint64_t deleteOptions4(const Subnet4Ptr& subnet) {
MySqlBindingCollection in_bindings = {
MySqlBinding::createInteger<uint32_t>(subnet->getID())
};
// Run DELETE.
- conn_.updateDeleteQuery(DELETE_OPTIONS4_SUBNET_ID, in_bindings);
+ return (conn_.updateDeleteQuery(DELETE_OPTIONS4_SUBNET_ID,
+ in_bindings));
}
/// @brief Deletes options belonging to a shared network from the database.
///
/// @param subnet Pointer to the subnet for which options should be
/// deleted.
- void deleteOptions4(const SharedNetwork4Ptr& shared_network) {
+ /// @return Number of deleted options.
+ uint64_t deleteOptions4(const SharedNetwork4Ptr& shared_network) {
MySqlBindingCollection in_bindings = {
MySqlBinding::createString(shared_network->getName())
};
// Run DELETE.
- conn_.updateDeleteQuery(DELETE_OPTIONS4_SHARED_NETWORK, in_bindings);
+ return (conn_.updateDeleteQuery(DELETE_OPTIONS4_SHARED_NETWORK,
+ in_bindings));
}
};
MySqlConfigBackendDHCPv4::createUpdateOption4(const db::ServerSelector& server_selector,
const std::string& shared_network_name,
const OptionDescriptorPtr& option) {
- impl_->createUpdateOption4(selector, shared_network_name, option);
+ impl_->createUpdateOption4(server_selector, shared_network_name, option);
}
void
}
uint64_t
-MySqlConfigBackendDHCPv4::deleteOption4(const ServerSelector& selector,
+MySqlConfigBackendDHCPv4::deleteOption4(const ServerSelector& server_selector,
const uint16_t code,
const std::string& space) {
- impl_->deleteOption4(selector, code, space);
+ return (impl_->deleteOption4(server_selector, code, space));
}
uint64_t
const std::string& shared_network_name,
const uint16_t code,
const std::string& space) {
- impl_->deleteOption4(selector, shared_network_name, code, space);
+ return (impl_->deleteOption4(server_selector, shared_network_name,
+ code, space));
}
-void
+uint64_t
MySqlConfigBackendDHCPv4::deleteOption4(const ServerSelector& selector,
const SubnetID& subnet_id,
const uint16_t code,
const std::string& space) {
- impl_->deleteOption4(selector, subnet_id, code, space);
+ return (impl_->deleteOption4(selector, subnet_id, code, space));
}
uint64_t
const asiolink::IOAddress& pool_end_address,
const uint16_t code,
const std::string& space) {
- impl_->deleteOption4(selector, pool_start_address, pool_end_address,
- code, space);
+ return (impl_->deleteOption4(selector, pool_start_address, pool_end_address,
+ code, space));
}
uint64_t
ConfigBackendPoolDHCPv4::createUpdateOption4(const BackendSelector& backend_selector,
const ServerSelector& server_selector,
const OptionDescriptorPtr& option) {
- createUpdateDeleteProperty<void, const OptionPtr&>
+ createUpdateDeleteProperty<void, const OptionDescriptorPtr&>
(&ConfigBackendDHCPv4::createUpdateOption4, backend_selector,
server_selector, option);
}
const ServerSelector& server_selector,
const std::string& shared_network_name,
const OptionDescriptorPtr& option) {
- createUpdateDeleteProperty<const std::string&, const OptionDescriptorPtr&>
+ createUpdateDeleteProperty<void, const std::string&, const OptionDescriptorPtr&>
(&ConfigBackendDHCPv4::createUpdateOption4, backend_selector,
server_selector, shared_network_name, option);
}
const ServerSelector& server_selector,
const SubnetID& subnet_id,
const OptionDescriptorPtr& option) {
- createUpdateDeleteProperty<void, const SubnetID&, const OptionPtr&>
+ createUpdateDeleteProperty<void, const SubnetID&, const OptionDescriptorPtr&>
(&ConfigBackendDHCPv4::createUpdateOption4, backend_selector,
server_selector, subnet_id, option);
}
const IOAddress& pool_start_address,
const IOAddress& pool_end_address,
const OptionDescriptorPtr& option) {
- createUpdateDeleteProperty<void, const IOAddress&, const IOAddress&, const OptionPtr&>
+ createUpdateDeleteProperty<void, const IOAddress&, const IOAddress&,
const OptionDescriptorPtr&>
(&ConfigBackendDHCPv4::createUpdateOption4, backend_selector,
server_selector, pool_start_address, pool_end_address, option);
code, space));
}
-void
+uint64_t
ConfigBackendPoolDHCPv4::deleteOption4(const BackendSelector& backend_selector,
const ServerSelector& server_selector,
const std::string& shared_network_name,
const uint16_t code,
const std::string& space) {
- createUpdateDeleteProperty<const std::string&, uint16_t, const std::string&>
- (&ConfigBackendDHCPv4::deleteOption4, backend_selector, server_selector,
- shared_network_name, code, space);
+ return (createUpdateDeleteProperty<uint64_t, const std::string&, const uint16_t,
+ const std::string&>
+ (&ConfigBackendDHCPv4::deleteOption4, backend_selector, server_selector,
+ shared_network_name, code, space));
}
uint64_t