Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
c89e1b38
Commit
c89e1b38
authored
Mar 02, 2016
by
Marcin Siodelski
Browse files
[4212] Renamed two variables to adhere to our coding guidelines.
Also, use new constant for checking fetch failure in MySQL.
parent
24b7fb0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcpsrv/mysql_host_data_source.cc
View file @
c89e1b38
...
...
@@ -880,9 +880,9 @@ MySqlHostDataSource::MySqlHostDataSource(
// Create the exchange objects for use in exchanging data between the
// program and the database.
host
E
xchange_
.
reset
(
new
MySqlHostReservationExchange
());
host
_e
xchange_
.
reset
(
new
MySqlHostReservationExchange
());
resv
E
xchange_
.
reset
(
new
MySqlIPv6ReservationExchange
());
resv
_e
xchange_
.
reset
(
new
MySqlIPv6ReservationExchange
());
}
MySqlHostDataSource
::~
MySqlHostDataSource
()
{
...
...
@@ -914,7 +914,7 @@ MySqlHostDataSource::add(const HostPtr& host) {
isc_throw
(
DuplicateEntry
,
"Host with same parameters already exists."
);
}
else
{
// Create the MYSQL_BIND array for the host
std
::
vector
<
MYSQL_BIND
>
bind
=
host
E
xchange_
->
createBindForSend
(
host
);
std
::
vector
<
MYSQL_BIND
>
bind
=
host
_e
xchange_
->
createBindForSend
(
host
);
// ... and call addHost() code.
addQuery
(
INSERT_HOST
,
bind
);
...
...
@@ -936,7 +936,7 @@ MySqlHostDataSource::add(const HostPtr& host) {
void
MySqlHostDataSource
::
addResv
(
const
IPv6Resrv
&
resv
,
HostID
id
)
{
std
::
vector
<
MYSQL_BIND
>
bind
=
resv
E
xchange_
->
createBindForSend
(
resv
,
id
);
resv
_e
xchange_
->
createBindForSend
(
resv
,
id
);
addQuery
(
INSERT_V6_RESRV
,
bind
);
}
...
...
@@ -1030,7 +1030,7 @@ MySqlHostDataSource::getAllReservations(HostID host_id) const{
inbind
[
0
].
is_unsigned
=
MLM_TRUE
;
IPv6ResrvCollection
result
;
getIPv6ReservationCollection
(
GET_V6_RESRV
,
inbind
,
resv
E
xchange_
,
result
);
getIPv6ReservationCollection
(
GET_V6_RESRV
,
inbind
,
resv
_e
xchange_
,
result
);
return
(
result
);
}
...
...
@@ -1078,7 +1078,8 @@ MySqlHostDataSource::getHostCollection(StatementIndex stindex, MYSQL_BIND* bind,
MySqlFreeResult
fetch_release
(
conn_
.
statements_
[
stindex
]);
int
count
=
0
;
HostPtr
host
;
while
((
status
=
mysql_stmt_fetch
(
conn_
.
statements_
[
stindex
]))
==
0
)
{
while
((
status
=
mysql_stmt_fetch
(
conn_
.
statements_
[
stindex
]))
==
MLM_MYSQL_FETCH_SUCCESS
)
{
try
{
host
=
exchange
->
getHostData
();
assignReservations
(
host
);
...
...
@@ -1153,7 +1154,7 @@ MySqlHostDataSource::getAll(const HWAddrPtr& hwaddr, const DuidPtr& duid) const
inbind
[
1
].
is_unsigned
=
MLM_TRUE
;
ConstHostCollection
result
;
getHostCollection
(
GET_HOST_HWADDR_DUID
,
inbind
,
host
E
xchange_
,
result
,
false
);
getHostCollection
(
GET_HOST_HWADDR_DUID
,
inbind
,
host
_e
xchange_
,
result
,
false
);
return
(
result
);
}
...
...
@@ -1171,7 +1172,7 @@ MySqlHostDataSource::getAll4(const asiolink::IOAddress& address) const {
inbind
[
0
].
is_unsigned
=
MLM_TRUE
;
ConstHostCollection
result
;
getHostCollection
(
GET_HOST_ADDR
,
inbind
,
host
E
xchange_
,
result
,
false
);
getHostCollection
(
GET_HOST_ADDR
,
inbind
,
host
_e
xchange_
,
result
,
false
);
return
(
result
);
}
...
...
@@ -1236,7 +1237,7 @@ MySqlHostDataSource::get4(const SubnetID& subnet_id, const HWAddrPtr& hwaddr,
inbind
[
1
].
is_unsigned
=
MLM_TRUE
;
ConstHostCollection
collection
;
getHostCollection
(
GET_HOST_SUBID4_DHCPID
,
inbind
,
host
E
xchange_
,
getHostCollection
(
GET_HOST_SUBID4_DHCPID
,
inbind
,
host
_e
xchange_
,
collection
,
true
);
// 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
;
ConstHostCollection
collection
;
getHostCollection
(
GET_HOST_SUBID_ADDR
,
inbind
,
host
E
xchange_
,
getHostCollection
(
GET_HOST_SUBID_ADDR
,
inbind
,
host
_e
xchange_
,
collection
,
true
);
// 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
;
ConstHostCollection
collection
;
getHostCollection
(
GET_HOST_SUBID6_DHCPID
,
inbind
,
host
E
xchange_
,
getHostCollection
(
GET_HOST_SUBID6_DHCPID
,
inbind
,
host
_e
xchange_
,
collection
,
true
);
// Return single record if present, else clear the host.
...
...
@@ -1372,7 +1373,7 @@ MySqlHostDataSource::get6(const asiolink::IOAddress& prefix,
ConstHostCollection
collection
;
getHostCollection
(
GET_HOST_PREFIX
,
inbind
,
host
E
xchange_
,
getHostCollection
(
GET_HOST_PREFIX
,
inbind
,
host
_e
xchange_
,
collection
,
true
);
// Return single record if present, else clear the host.
...
...
src/lib/dhcpsrv/mysql_host_data_source.h
View file @
c89e1b38
...
...
@@ -354,10 +354,10 @@ private:
/// declare them as "mutable".)
/// @brief MySQL Host Reservation Exchange object
boost
::
shared_ptr
<
MySqlHostReservationExchange
>
host
E
xchange_
;
boost
::
shared_ptr
<
MySqlHostReservationExchange
>
host
_e
xchange_
;
/// @brief MySQL IPv6 Reservation Exchange object
boost
::
shared_ptr
<
MySqlIPv6ReservationExchange
>
resv
E
xchange_
;
boost
::
shared_ptr
<
MySqlIPv6ReservationExchange
>
resv
_e
xchange_
;
/// @brief MySQL connection
MySqlConnection
conn_
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment