2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 14:05:33 +00:00

[#2795] db inet type related changes

This commit is contained in:
Piotrek Zadroga
2023-06-22 18:20:55 +02:00
parent 668acb810a
commit cf98ce6055
2 changed files with 9 additions and 6 deletions

View File

@@ -4014,14 +4014,17 @@ MySqlHostDataSource::getAll6(const IOAddress& address) const {
MYSQL_BIND inbind[1];
memset(inbind, 0, sizeof(inbind));
std::string addr6 = address.toText();
unsigned long addr6_length = addr6.size();
std::vector<uint8_t>addr6 = address.toBytes();
if (addr6.size() != isc::asiolink::V6ADDRESS_LEN) {
isc_throw(DbOperationError, "getAll6() - address is not "
<< isc::asiolink::V6ADDRESS_LEN << " bytes long");
}
unsigned long addr6_length = isc::asiolink::V6ADDRESS_LEN;
inbind[0].buffer_type = MYSQL_TYPE_BLOB;
inbind[0].buffer = reinterpret_cast<char*>
(const_cast<char*>(addr6.c_str()));
inbind[0].buffer = reinterpret_cast<char*>(&addr6[0]);
inbind[0].buffer_length = isc::asiolink::V6ADDRESS_LEN;
inbind[0].length = &addr6_length;
inbind[0].buffer_length = addr6_length;
ConstHostCollection collection;
impl_->getHostCollection(ctx, MySqlHostDataSourceImpl::GET_HOST_ADDR6, inbind,

View File

@@ -1840,7 +1840,7 @@ TaggedStatementArray tagged_statements = { {
"LEFT JOIN ipv6_reservations AS r ON h.host_id = r.host_id "
"WHERE h.host_id IN "
" (SELECT host_id FROM ipv6_reservations "
" WHERE address = $1) "
" WHERE address = cast($1 as inet)) "
"ORDER BY h.host_id, o.option_id, r.reservation_id"
},