From: Francis Dupont Date: Mon, 11 Feb 2019 10:06:59 +0000 (+0100) Subject: [94-cb-implement-mysqlconfigbackenddhcpv6-prepare] Moved to push_back in getOptions X-Git-Tag: 397-cb-implement-mysqlconfigbackenddhcpv6_base~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=53761d446fcc032ba538c3c908e3643ff8060b7d;p=thirdparty%2Fkea.git [94-cb-implement-mysqlconfigbackenddhcpv6-prepare] Moved to push_back in getOptions --- diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc index 53e5d5e1c4..1ddd5e211a 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc @@ -285,36 +285,39 @@ MySqlConfigBackendImpl::getOptions(const int index, OptionContainer& options) { // Create output bindings. The order must match that in the prepared // statement. - MySqlBindingCollection out_bindings = { - MySqlBinding::createInteger(), // option_id - // code will go here. - MySqlBinding::createBlob(OPTION_VALUE_BUF_LENGTH), // value - MySqlBinding::createString(FORMATTED_OPTION_VALUE_BUF_LENGTH), // formatted_value - MySqlBinding::createString(OPTION_SPACE_BUF_LENGTH), // space - MySqlBinding::createInteger(), // persistent - MySqlBinding::createInteger(), // dhcp[46]_subnet_id - MySqlBinding::createInteger(), // scope_id - MySqlBinding::createString(USER_CONTEXT_BUF_LENGTH), // user_context - MySqlBinding::createString(SHARED_NETWORK_NAME_BUF_LENGTH), // shared_network_name - MySqlBinding::createInteger(), // pool_id - // pd_pool_id in DHCPv6 - MySqlBinding::createTimestamp() // modification_ts - }; - - // Insert code in the second position. + MySqlBindingCollection out_bindings; + // option_id + out_bindings.push_back(MySqlBinding::createInteger()); + // code if (universe == Option::V4) { - out_bindings.insert(out_bindings.begin() + 1, - MySqlBinding::createInteger()); + out_bindings.push_back(MySqlBinding::createInteger()); } else { - out_bindings.insert(out_bindings.begin() + 1, - MySqlBinding::createInteger()); + out_bindings.push_back(MySqlBinding::createInteger()); } - - // Insert pd_pool_id before the modification_ts / last field + // value + out_bindings.push_back(MySqlBinding::createBlob(OPTION_VALUE_BUF_LENGTH)); + // forma\tted_value + out_bindings.push_back(MySqlBinding::createString(FORMATTED_OPTION_VALUE_BUF_LENGTH)); + // space + out_bindings.push_back(MySqlBinding::createString(OPTION_SPACE_BUF_LENGTH)); + // persistent + out_bindings.push_back(MySqlBinding::createInteger()); + // dhcp[46]_subnet_id + out_bindings.push_back(MySqlBinding::createInteger()); + // scope_id + out_bindings.push_back(MySqlBinding::createInteger()); + // user_context + out_bindings.push_back(MySqlBinding::createString(USER_CONTEXT_BUF_LENGTH)); + // shared_network_name + out_bindings.push_back(MySqlBinding::createString(SHARED_NETWORK_NAME_BUF_LENGTH)); + // pool_id + out_bindings.push_back(MySqlBinding::createInteger()); + // pd_pool_id if (universe == Option::V6) { - out_bindings.insert(out_bindings.end() - 1, - MySqlBinding::createInteger()); + out_bindings.push_back(MySqlBinding::createInteger()); } + // modification_ts + out_bindings.push_back(MySqlBinding::createTimestamp()); uint64_t last_option_id = 0;