2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-01 14:35:29 +00:00

[4212] Renamed two variables to adhere to our coding guidelines.

Also, use new constant for checking fetch failure in MySQL.
This commit is contained in:
Marcin Siodelski
2016-03-02 00:05:11 +01:00
parent 24b7fb0e6f
commit c89e1b38fe
2 changed files with 15 additions and 14 deletions

View File

@@ -880,9 +880,9 @@ MySqlHostDataSource::MySqlHostDataSource(
// Create the exchange objects for use in exchanging data between the // Create the exchange objects for use in exchanging data between the
// program and the database. // program and the database.
hostExchange_.reset(new MySqlHostReservationExchange()); host_exchange_.reset(new MySqlHostReservationExchange());
resvExchange_.reset(new MySqlIPv6ReservationExchange()); resv_exchange_.reset(new MySqlIPv6ReservationExchange());
} }
MySqlHostDataSource::~MySqlHostDataSource() { MySqlHostDataSource::~MySqlHostDataSource() {
@@ -914,7 +914,7 @@ MySqlHostDataSource::add(const HostPtr& host) {
isc_throw(DuplicateEntry, "Host with same parameters already exists."); isc_throw(DuplicateEntry, "Host with same parameters already exists.");
} else { } else {
// Create the MYSQL_BIND array for the host // Create the MYSQL_BIND array for the host
std::vector<MYSQL_BIND> bind = hostExchange_->createBindForSend(host); std::vector<MYSQL_BIND> bind = host_exchange_->createBindForSend(host);
// ... and call addHost() code. // ... and call addHost() code.
addQuery(INSERT_HOST, bind); addQuery(INSERT_HOST, bind);
@@ -936,7 +936,7 @@ MySqlHostDataSource::add(const HostPtr& host) {
void void
MySqlHostDataSource::addResv(const IPv6Resrv& resv, HostID id) { MySqlHostDataSource::addResv(const IPv6Resrv& resv, HostID id) {
std::vector<MYSQL_BIND> bind = std::vector<MYSQL_BIND> bind =
resvExchange_->createBindForSend(resv, id); resv_exchange_->createBindForSend(resv, id);
addQuery(INSERT_V6_RESRV, bind); addQuery(INSERT_V6_RESRV, bind);
} }
@@ -1030,7 +1030,7 @@ MySqlHostDataSource::getAllReservations(HostID host_id) const{
inbind[0].is_unsigned = MLM_TRUE; inbind[0].is_unsigned = MLM_TRUE;
IPv6ResrvCollection result; IPv6ResrvCollection result;
getIPv6ReservationCollection(GET_V6_RESRV, inbind, resvExchange_, result); getIPv6ReservationCollection(GET_V6_RESRV, inbind, resv_exchange_, result);
return (result); return (result);
} }
@@ -1078,7 +1078,8 @@ MySqlHostDataSource::getHostCollection(StatementIndex stindex, MYSQL_BIND* bind,
MySqlFreeResult fetch_release(conn_.statements_[stindex]); MySqlFreeResult fetch_release(conn_.statements_[stindex]);
int count = 0; int count = 0;
HostPtr host; HostPtr host;
while ((status = mysql_stmt_fetch(conn_.statements_[stindex])) == 0) { while ((status = mysql_stmt_fetch(conn_.statements_[stindex])) ==
MLM_MYSQL_FETCH_SUCCESS) {
try { try {
host = exchange->getHostData(); host = exchange->getHostData();
assignReservations(host); assignReservations(host);
@@ -1153,7 +1154,7 @@ MySqlHostDataSource::getAll(const HWAddrPtr& hwaddr, const DuidPtr& duid) const
inbind[1].is_unsigned = MLM_TRUE; inbind[1].is_unsigned = MLM_TRUE;
ConstHostCollection result; ConstHostCollection result;
getHostCollection(GET_HOST_HWADDR_DUID, inbind, hostExchange_, result, false); getHostCollection(GET_HOST_HWADDR_DUID, inbind, host_exchange_, result, false);
return (result); return (result);
} }
@@ -1171,7 +1172,7 @@ MySqlHostDataSource::getAll4(const asiolink::IOAddress& address) const {
inbind[0].is_unsigned = MLM_TRUE; inbind[0].is_unsigned = MLM_TRUE;
ConstHostCollection result; ConstHostCollection result;
getHostCollection(GET_HOST_ADDR, inbind, hostExchange_, result, false); getHostCollection(GET_HOST_ADDR, inbind, host_exchange_, result, false);
return (result); return (result);
} }
@@ -1236,7 +1237,7 @@ MySqlHostDataSource::get4(const SubnetID& subnet_id, const HWAddrPtr& hwaddr,
inbind[1].is_unsigned = MLM_TRUE; inbind[1].is_unsigned = MLM_TRUE;
ConstHostCollection collection; ConstHostCollection collection;
getHostCollection(GET_HOST_SUBID4_DHCPID, inbind, hostExchange_, getHostCollection(GET_HOST_SUBID4_DHCPID, inbind, host_exchange_,
collection, true); collection, true);
// Return single record if present, else clear the host. // Return single record if present, else clear the host.
@@ -1265,7 +1266,7 @@ MySqlHostDataSource::get4(const SubnetID& subnet_id,
inbind[1].is_unsigned = MLM_TRUE; inbind[1].is_unsigned = MLM_TRUE;
ConstHostCollection collection; ConstHostCollection collection;
getHostCollection(GET_HOST_SUBID_ADDR, inbind, hostExchange_, getHostCollection(GET_HOST_SUBID_ADDR, inbind, host_exchange_,
collection, true); collection, true);
// Return single record if present, else clear the host. // Return single record if present, else clear the host.
@@ -1335,7 +1336,7 @@ MySqlHostDataSource::get6(const SubnetID& subnet_id, const DuidPtr& duid,
inbind[1].is_unsigned = MLM_TRUE; inbind[1].is_unsigned = MLM_TRUE;
ConstHostCollection collection; ConstHostCollection collection;
getHostCollection(GET_HOST_SUBID6_DHCPID, inbind, hostExchange_, getHostCollection(GET_HOST_SUBID6_DHCPID, inbind, host_exchange_,
collection, true); collection, true);
// Return single record if present, else clear the host. // Return single record if present, else clear the host.
@@ -1372,7 +1373,7 @@ MySqlHostDataSource::get6(const asiolink::IOAddress& prefix,
ConstHostCollection collection; ConstHostCollection collection;
getHostCollection(GET_HOST_PREFIX, inbind, hostExchange_, getHostCollection(GET_HOST_PREFIX, inbind, host_exchange_,
collection, true); collection, true);
// Return single record if present, else clear the host. // Return single record if present, else clear the host.

View File

@@ -354,10 +354,10 @@ private:
/// declare them as "mutable".) /// declare them as "mutable".)
/// @brief MySQL Host Reservation Exchange object /// @brief MySQL Host Reservation Exchange object
boost::shared_ptr<MySqlHostReservationExchange> hostExchange_; boost::shared_ptr<MySqlHostReservationExchange> host_exchange_;
/// @brief MySQL IPv6 Reservation Exchange object /// @brief MySQL IPv6 Reservation Exchange object
boost::shared_ptr<MySqlIPv6ReservationExchange> resvExchange_; boost::shared_ptr<MySqlIPv6ReservationExchange> resv_exchange_;
/// @brief MySQL connection /// @brief MySQL connection
MySqlConnection conn_; MySqlConnection conn_;