// statement. Please put comments only at the end of line so
// line counting and indexing match.
// The server tag must be the last field.
- MySqlBindingCollection out_bindings = {
+ MySqlBindingCollection out_binds = {
MySqlBinding::createInteger<uint32_t>(), // subnet_id
MySqlBinding::createString(SUBNET6_PREFIX_BUF_LENGTH), // subnet_prefix
MySqlBinding::createString(CLIENT_CLASS_BUF_LENGTH), // client_class
std::string last_tag;
// Execute actual query.
- conn_.selectQuery(index, in_bindings, out_bindings,
+ conn_.selectQuery(index, in_bindings, out_binds,
[this, &subnets, &last_pool, &last_pd_pool,
&last_pool_id, &last_pd_pool_id,
&last_pool_option_id, &last_pd_pool_option_id,
const MySqlBindingCollection& in_bindings,
PoolCollection& pools,
std::vector<uint64_t>& pool_ids) {
- MySqlBindingCollection out_bindings = {
+ MySqlBindingCollection out_binds = {
MySqlBinding::createInteger<uint64_t>(), // pool: id
MySqlBinding::createString(POOL_ADDRESS6_BUF_LENGTH), // pool: start_address
MySqlBinding::createString(POOL_ADDRESS6_BUF_LENGTH), // pool: end_address
uint64_t last_pool_option_id = 0;
Pool6Ptr last_pool;
- conn_.selectQuery(index, in_bindings, out_bindings,
+ conn_.selectQuery(index, in_bindings, out_binds,
[this, &last_pool_id, &last_pool_option_id, &last_pool,
&pools, &pool_ids]
(MySqlBindingCollection& out_bindings) {
const MySqlBindingCollection& in_bindings,
PoolCollection& pd_pools,
std::vector<uint64_t>& pd_pool_ids) {
- MySqlBindingCollection out_bindings = {
+ MySqlBindingCollection out_binds = {
MySqlBinding::createInteger<uint64_t>(), // pd pool: id
MySqlBinding::createString(POOL_ADDRESS6_BUF_LENGTH), // pd pool: prefix
MySqlBinding::createInteger<uint8_t>(), // pd pool: prefix_length
uint64_t last_pd_pool_option_id = 0;
Pool6Ptr last_pd_pool;
- conn_.selectQuery(index, in_bindings, out_bindings,
+ conn_.selectQuery(index, in_bindings, out_binds,
[this, &last_pd_pool_id, &last_pd_pool_option_id,
&last_pd_pool, &pd_pools, &pd_pool_ids]
(MySqlBindingCollection& out_bindings) {
// statement. Please put comments only at the end of line so
// line counting and indexing match.
// The server tag must be the last field.
- MySqlBindingCollection out_bindings = {
+ MySqlBindingCollection out_binds = {
MySqlBinding::createInteger<uint64_t>(), // id
MySqlBinding::createString(SHARED_NETWORK_NAME_BUF_LENGTH), // name
MySqlBinding::createString(CLIENT_CLASS_LIST_BUF_LENGTH), // client_classes
uint64_t last_option_id = 0;
std::string last_tag;
- conn_.selectQuery(index, in_bindings, out_bindings,
+ conn_.selectQuery(index, in_bindings, out_binds,
[this, &shared_networks, &last_network_id, &last_option_id,
&last_tag]
(MySqlBindingCollection& out_bindings) {
const ServerSelector& server_selector,
const MySqlBindingCollection& in_bindings,
ClientClassDictionary& client_classes) {
- MySqlBindingCollection out_bindings = {
+ MySqlBindingCollection out_binds = {
MySqlBinding::createInteger<uint64_t>(), // id
MySqlBinding::createString(CLIENT_CLASS_NAME_BUF_LENGTH), // name
MySqlBinding::createString(CLIENT_CLASS_TEST_BUF_LENGTH), // test
std::string last_tag;
conn_.selectQuery(index,
- in_bindings, out_bindings,
+ in_bindings, out_binds,
[this, &class_list, &last_option_id, &last_option_def_id, &last_tag]
(MySqlBindingCollection& out_bindings) {
ClientClassDefPtr last_client_class;
tag = tags.begin()->get();
}
- MySqlBindingCollection in_bindings = {
+ MySqlBindingCollection in_binds = {
MySqlBinding::createTimestamp(audit_ts),
MySqlBinding::createString(tag),
MySqlBinding::createString(log_message),
MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(cascade_transaction))
};
- conn_.insertQuery(index, in_bindings);
+ conn_.insertQuery(index, in_binds);
}
void
const uint64_t& modification_id,
AuditEntryCollection& audit_entries) {
// Create the output bindings for receiving the data.
- MySqlBindingCollection out_bindings = {
+ MySqlBindingCollection out_binds = {
MySqlBinding::createInteger<uint64_t>(), // id
MySqlBinding::createString(AUDIT_ENTRY_OBJECT_TYPE_BUF_LENGTH), // object_type
MySqlBinding::createInteger<uint64_t>(), // object_id
for (auto const& tag : tags) {
// There are only a few input bindings
- MySqlBindingCollection in_bindings = {
+ MySqlBindingCollection in_binds = {
MySqlBinding::createString(tag.get()),
MySqlBinding::createTimestamp(modification_time),
MySqlBinding::createInteger<uint64_t>(modification_id)
};
// Execute select.
- conn_.selectQuery(index, in_bindings, out_bindings,
+ conn_.selectQuery(index, in_binds, out_binds,
[&audit_entries] (MySqlBindingCollection& out_bindings) {
// Convert the numeric modification type into modification type enum.
AuditEntry::ModificationType mod_type =
" supported");
}
- MySqlBindingCollection in_bindings;
- return (deleteFromTable(index, server_selector, operation, in_bindings));
+ MySqlBindingCollection in_binds;
+ return (deleteFromTable(index, server_selector, operation, in_binds));
}
void
MySqlConfigBackendImpl::getGlobalParameters(const int index,
- const MySqlBindingCollection& in_bindings,
+ const MySqlBindingCollection& in_binds,
StampedValueCollection& parameters) {
// The following parameters from the dhcp[46]_global_parameter table are
// returned:
// - name - parameter name
// - value - parameter value
// - modification_ts - modification timestamp.
- MySqlBindingCollection out_bindings = {
+ MySqlBindingCollection out_binds = {
MySqlBinding::createInteger<uint64_t>(), // id
MySqlBinding::createString(GLOBAL_PARAMETER_NAME_BUF_LENGTH), // name
MySqlBinding::createString(GLOBAL_PARAMETER_VALUE_BUF_LENGTH), // value
StampedValueCollection local_parameters;
- conn_.selectQuery(index, in_bindings, out_bindings,
+ conn_.selectQuery(index, in_binds, out_binds,
[&last_param, &local_parameters]
(MySqlBindingCollection& out_bindings) {
auto tag = getServerTag(server_selector, "fetching option definition");
OptionDefContainer option_defs;
- MySqlBindingCollection in_bindings = {
+ MySqlBindingCollection in_binds = {
MySqlBinding::createString(tag),
MySqlBinding::createInteger<uint16_t>(code),
MySqlBinding::createString(space)
};
- getOptionDefs(index, in_bindings, option_defs);
+ getOptionDefs(index, in_binds, option_defs);
return (option_defs.empty() ? OptionDefinitionPtr() : *option_defs.begin());
}
OptionDefContainer& option_defs) {
auto const& tags = server_selector.getTags();
for (auto const& tag : tags) {
- MySqlBindingCollection in_bindings = {
+ MySqlBindingCollection in_binds = {
MySqlBinding::createString(tag.get())
};
- getOptionDefs(index, in_bindings, option_defs);
+ getOptionDefs(index, in_binds, option_defs);
}
}
OptionDefContainer& option_defs) {
auto const& tags = server_selector.getTags();
for (auto const& tag : tags) {
- MySqlBindingCollection in_bindings = {
+ MySqlBindingCollection in_binds = {
MySqlBinding::createString(tag.get()),
MySqlBinding::createTimestamp(modification_time)
};
- getOptionDefs(index, in_bindings, option_defs);
+ getOptionDefs(index, in_binds, option_defs);
}
}
void
MySqlConfigBackendImpl::getOptionDefs(const int index,
- const MySqlBindingCollection& in_bindings,
+ const MySqlBindingCollection& in_binds,
OptionDefContainer& option_defs) {
// Create output bindings. The order must match that in the prepared
// statement.
- MySqlBindingCollection out_bindings = {
+ MySqlBindingCollection out_binds = {
MySqlBinding::createInteger<uint64_t>(), // id
MySqlBinding::createInteger<uint16_t>(), // code
MySqlBinding::createString(OPTION_NAME_BUF_LENGTH), // name
OptionDefContainer local_option_defs;
// Run select query.
- conn_.selectQuery(index, in_bindings, out_bindings,
+ conn_.selectQuery(index, in_binds, out_binds,
[this, &local_option_defs, &last_def_id]
(MySqlBindingCollection& out_bindings) {
// Get pointer to last fetched option definition.
MySqlBindingPtr client_class_binding = client_class_name.empty() ?
MySqlBinding::createNull() : MySqlBinding::createString(client_class_name);
- MySqlBindingCollection in_bindings = {
+ MySqlBindingCollection in_binds = {
MySqlBinding::createInteger<uint16_t>(option_def->getCode()),
MySqlBinding::createString(option_def->getName()),
MySqlBinding::createString(option_def->getOptionSpaceName()),
"option definition set",
true);
- if (conn_.updateDeleteQuery(update_option_def, in_bindings) == 0) {
+ if (conn_.updateDeleteQuery(update_option_def, in_binds) == 0) {
// Remove the bindings used only during the update.
- in_bindings.resize(in_bindings.size() - 3);
- conn_.insertQuery(insert_option_def, in_bindings);
+ in_binds.resize(in_binds.size() - 3);
+ conn_.insertQuery(insert_option_def, in_binds);
// Fetch unique identifier of the inserted option definition and use it
// as input to the next query.
auto tag = getServerTag(server_selector, "fetching global option");
OptionContainer options;
- MySqlBindingCollection in_bindings;
- in_bindings.push_back(MySqlBinding::createString(tag));
+ MySqlBindingCollection in_binds;
+ in_binds.push_back(MySqlBinding::createString(tag));
if (universe == Option::V4) {
- in_bindings.push_back(MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(code)));
+ in_binds.push_back(MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(code)));
} else {
- in_bindings.push_back(MySqlBinding::createInteger<uint16_t>(code));
+ in_binds.push_back(MySqlBinding::createInteger<uint16_t>(code));
}
- in_bindings.push_back(MySqlBinding::createString(space));
- in_bindings.push_back(createClientClassesForWhereClause(client_classes));
+ in_binds.push_back(MySqlBinding::createString(space));
+ in_binds.push_back(createClientClassesForWhereClause(client_classes));
- getOptions(index, in_bindings, universe, options);
+ getOptions(index, in_binds, universe, options);
return (options.empty() ? OptionDescriptorPtr() :
OptionDescriptor::create(*options.begin()));
}
auto const& tags = server_selector.getTags();
for (auto const& tag : tags) {
- MySqlBindingCollection in_bindings = {
+ MySqlBindingCollection in_binds = {
MySqlBinding::createString(tag.get())
};
- getOptions(index, in_bindings, universe, options);
+ getOptions(index, in_binds, universe, options);
}
return (options);
auto const& tags = server_selector.getTags();
for (auto const& tag : tags) {
- MySqlBindingCollection in_bindings = {
+ MySqlBindingCollection in_binds = {
MySqlBinding::createString(tag.get()),
MySqlBinding::createTimestamp(modification_time)
};
- getOptions(index, in_bindings, universe, options);
+ getOptions(index, in_binds, universe, options);
}
return (options);
auto tag = getServerTag(server_selector, "fetching subnet level option");
OptionContainer options;
- MySqlBindingCollection in_bindings;
- in_bindings.push_back(MySqlBinding::createString(tag));
+ MySqlBindingCollection in_binds;
+ in_binds.push_back(MySqlBinding::createString(tag));
uint32_t id = static_cast<uint32_t>(subnet_id);
- in_bindings.push_back(MySqlBinding::createInteger<uint32_t>(id));
+ in_binds.push_back(MySqlBinding::createInteger<uint32_t>(id));
if (universe == Option::V4) {
- in_bindings.push_back(MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(code)));
+ in_binds.push_back(MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(code)));
} else {
- in_bindings.push_back(MySqlBinding::createInteger<uint16_t>(code));
+ in_binds.push_back(MySqlBinding::createInteger<uint16_t>(code));
}
- in_bindings.push_back(MySqlBinding::createString(space));
- getOptions(index, in_bindings, universe, options);
+ in_binds.push_back(MySqlBinding::createString(space));
+ getOptions(index, in_binds, universe, options);
return (options.empty() ? OptionDescriptorPtr() :
OptionDescriptor::create(*options.begin()));
}
Option::Universe universe = Option::V4;
OptionContainer options;
- MySqlBindingCollection in_bindings;
- in_bindings.push_back(MySqlBinding::createString(tag));
- in_bindings.push_back(MySqlBinding::createInteger<uint64_t>(pool_id));
+ MySqlBindingCollection in_binds;
+ in_binds.push_back(MySqlBinding::createString(tag));
+ in_binds.push_back(MySqlBinding::createInteger<uint64_t>(pool_id));
if (pool_type == Lease::TYPE_V4) {
- in_bindings.push_back(MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(code)));
+ in_binds.push_back(MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(code)));
} else {
- in_bindings.push_back(MySqlBinding::createInteger<uint16_t>(code));
+ in_binds.push_back(MySqlBinding::createInteger<uint16_t>(code));
universe = Option::V6;
}
- in_bindings.push_back(MySqlBinding::createString(space));
- getOptions(index, in_bindings, universe, options);
+ in_binds.push_back(MySqlBinding::createString(space));
+ getOptions(index, in_binds, universe, options);
return (options.empty() ? OptionDescriptorPtr() :
OptionDescriptor::create(*options.begin()));
}
auto tag = getServerTag(server_selector, "fetching shared network level option");
OptionContainer options;
- MySqlBindingCollection in_bindings;
- in_bindings.push_back(MySqlBinding::createString(tag));
- in_bindings.push_back(MySqlBinding::createString(shared_network_name));
+ MySqlBindingCollection in_binds;
+ in_binds.push_back(MySqlBinding::createString(tag));
+ in_binds.push_back(MySqlBinding::createString(shared_network_name));
if (universe == Option::V4) {
- in_bindings.push_back(MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(code)));
+ in_binds.push_back(MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(code)));
} else {
- in_bindings.push_back(MySqlBinding::createInteger<uint16_t>(code));
+ in_binds.push_back(MySqlBinding::createInteger<uint16_t>(code));
}
- in_bindings.push_back(MySqlBinding::createString(space));
- getOptions(index, in_bindings, universe, options);
+ in_binds.push_back(MySqlBinding::createString(space));
+ getOptions(index, in_binds, universe, options);
return (options.empty() ? OptionDescriptorPtr() :
OptionDescriptor::create(*options.begin()));
}
void
MySqlConfigBackendImpl::getOptions(const int index,
- const db::MySqlBindingCollection& in_bindings,
+ const db::MySqlBindingCollection& in_binds,
const Option::Universe& universe,
OptionContainer& options) {
// Create output bindings. The order must match that in the prepared
// statement.
- MySqlBindingCollection out_bindings;
+ MySqlBindingCollection out_binds;
// option_id
- out_bindings.push_back(MySqlBinding::createInteger<uint64_t>());
+ out_binds.push_back(MySqlBinding::createInteger<uint64_t>());
// code
if (universe == Option::V4) {
- out_bindings.push_back(MySqlBinding::createInteger<uint8_t>());
+ out_binds.push_back(MySqlBinding::createInteger<uint8_t>());
} else {
- out_bindings.push_back(MySqlBinding::createInteger<uint16_t>());
+ out_binds.push_back(MySqlBinding::createInteger<uint16_t>());
}
// value
- out_bindings.push_back(MySqlBinding::createBlob(OPTION_VALUE_BUF_LENGTH));
+ out_binds.push_back(MySqlBinding::createBlob(OPTION_VALUE_BUF_LENGTH));
// formatted_value
- out_bindings.push_back(MySqlBinding::createString(FORMATTED_OPTION_VALUE_BUF_LENGTH));
+ out_binds.push_back(MySqlBinding::createString(FORMATTED_OPTION_VALUE_BUF_LENGTH));
// space
- out_bindings.push_back(MySqlBinding::createString(OPTION_SPACE_BUF_LENGTH));
+ out_binds.push_back(MySqlBinding::createString(OPTION_SPACE_BUF_LENGTH));
// persistent
- out_bindings.push_back(MySqlBinding::createInteger<uint8_t>());
+ out_binds.push_back(MySqlBinding::createInteger<uint8_t>());
// cancelled
- out_bindings.push_back(MySqlBinding::createInteger<uint8_t>());
+ out_binds.push_back(MySqlBinding::createInteger<uint8_t>());
// dhcp[46]_subnet_id
- out_bindings.push_back(MySqlBinding::createInteger<uint32_t>());
+ out_binds.push_back(MySqlBinding::createInteger<uint32_t>());
// scope_id
- out_bindings.push_back(MySqlBinding::createInteger<uint8_t>());
+ out_binds.push_back(MySqlBinding::createInteger<uint8_t>());
// user_context
- out_bindings.push_back(MySqlBinding::createString(USER_CONTEXT_BUF_LENGTH));
+ out_binds.push_back(MySqlBinding::createString(USER_CONTEXT_BUF_LENGTH));
// shared_network_name
- out_bindings.push_back(MySqlBinding::createString(SHARED_NETWORK_NAME_BUF_LENGTH));
+ out_binds.push_back(MySqlBinding::createString(SHARED_NETWORK_NAME_BUF_LENGTH));
// pool_id
- out_bindings.push_back(MySqlBinding::createInteger<uint64_t>());
+ out_binds.push_back(MySqlBinding::createInteger<uint64_t>());
// modification_ts
- out_bindings.push_back(MySqlBinding::createTimestamp());
+ out_binds.push_back(MySqlBinding::createTimestamp());
// client_classes
- out_bindings.push_back(MySqlBinding::createString(CLIENT_CLASS_LIST_BUF_LENGTH));
+ out_binds.push_back(MySqlBinding::createString(CLIENT_CLASS_LIST_BUF_LENGTH));
// server_tag
- out_bindings.push_back(MySqlBinding::createString(SERVER_TAG_BUF_LENGTH));
+ out_binds.push_back(MySqlBinding::createString(SERVER_TAG_BUF_LENGTH));
// pd_pool_id
if (universe == Option::V6) {
- out_bindings.push_back(MySqlBinding::createInteger<uint64_t>());
+ out_binds.push_back(MySqlBinding::createInteger<uint64_t>());
}
uint64_t last_option_id = 0;
OptionContainer local_options;
- conn_.selectQuery(index, in_bindings, out_bindings,
+ conn_.selectQuery(index, in_binds, out_binds,
[this, universe, &local_options, &last_option_id]
(MySqlBindingCollection& out_bindings) {
// Parse option.
MySqlConfigBackendImpl::attachElementToServers(const int index,
const ServerSelector& server_selector,
const MySqlBindingPtr& first_binding,
- const MySqlBindingPtr& in_bindings) {
+ const MySqlBindingPtr& in_binds) {
// Create the vector from the parameter pack.
- MySqlBindingCollection in_server_bindings = { first_binding, in_bindings };
+ MySqlBindingCollection in_server_bindings = { first_binding, in_binds };
for (auto const& tag : server_selector.getTags()) {
in_server_bindings.push_back(MySqlBinding::createString(tag.get()));
// Handles the case where the server does not exists.
ServerPtr
MySqlConfigBackendImpl::getServer(const int index, const ServerTag& server_tag) {
ServerCollection servers;
- MySqlBindingCollection in_bindings = {
+ MySqlBindingCollection in_binds = {
MySqlBinding::createString(server_tag.get())
};
- getServers(index, in_bindings, servers);
+ getServers(index, in_binds, servers);
return (servers.empty() ? ServerPtr() : *servers.begin());
}
void
MySqlConfigBackendImpl::getAllServers(const int index, db::ServerCollection& servers) {
- MySqlBindingCollection in_bindings;
- getServers(index, in_bindings, servers);
+ MySqlBindingCollection in_binds;
+ getServers(index, in_binds, servers);
}
void
MySqlConfigBackendImpl::getServers(const int index,
- const MySqlBindingCollection& in_bindings,
+ const MySqlBindingCollection& in_binds,
ServerCollection& servers) {
- MySqlBindingCollection out_bindings = {
+ MySqlBindingCollection out_binds = {
MySqlBinding::createInteger<uint64_t>(),
MySqlBinding::createString(SERVER_TAG_BUF_LENGTH),
MySqlBinding::createString(SERVER_DESCRIPTION_BUF_LENGTH),
MySqlBinding::createTimestamp()
};
- conn_.selectQuery(index, in_bindings, out_bindings,
+ conn_.selectQuery(index, in_binds, out_binds,
[&servers](MySqlBindingCollection& out_bindings) {
ServerPtr last_server;
MySqlTransaction transaction(conn_);
- MySqlBindingCollection in_bindings = {
+ MySqlBindingCollection in_binds = {
MySqlBinding::createString(server->getServerTagAsText()),
MySqlBinding::createString(server->getDescription()),
MySqlBinding::createTimestamp(server->getModificationTime())
};
try {
- conn_.insertQuery(create_index, in_bindings);
+ conn_.insertQuery(create_index, in_binds);
} catch (const DuplicateEntry&) {
- in_bindings.push_back(MySqlBinding::createString(server->getServerTagAsText()));
- conn_.updateDeleteQuery(update_index, in_bindings);
+ in_binds.push_back(MySqlBinding::createString(server->getServerTagAsText()));
+ conn_.updateDeleteQuery(update_index, in_binds);
}
transaction.commit();