static constexpr StatementTag GET_HOST_BY_IPV4_SUBNET_ID_LIMIT =
"GET_HOST_BY_IPV4_SUBNET_ID_LIMIT";
- // Retrieves host information along with the IPv4 options associated
- // with it using a subnet identifier from host (paging).
- static constexpr StatementTag GET_HOST_BY_IPV4_SUBNET_ID_KEY =
- "GET_HOST_BY_IPV4_SUBNET_ID_KEY";
-
// Retrieves host information along with the IPv4 options associated
// with it using a subnet identifier from next host (paging).
static constexpr StatementTag GET_HOST_BY_IPV4_SUBNET_ID_NEXT_KEY =
static constexpr StatementTag GET_HOST_BY_IPV6_SUBNET_ID_LIMIT =
"GET_HOST_BY_IPV6_SUBNET_ID_LIMIT";
- // Retrieves host information; IPv6 reservations and IPv6 options
- // associated with it using subnet identifier from host (paging).
- static constexpr StatementTag GET_HOST_BY_IPV6_SUBNET_ID_KEY =
- "GET_HOST_BY_IPV6_SUBNET_ID_KEY";
-
// Retrieves host information; IPv6 reservations and IPv6 options
// associated with it using subnet identifier from next host (paging).
static constexpr StatementTag GET_HOST_BY_IPV6_SUBNET_ID_NEXT_KEY =
constexpr StatementTag CqlHostExchange::GET_HOST_BY_IPV6_SUBNET_ID_LIMIT;
constexpr StatementTag CqlHostExchange::GET_HOST_BY_IPV4_SUBNET_ID_NEXT_KEY;
constexpr StatementTag CqlHostExchange::GET_HOST_BY_IPV6_SUBNET_ID_NEXT_KEY;
-constexpr StatementTag CqlHostExchange::GET_HOST_BY_IPV4_SUBNET_ID_KEY;
-constexpr StatementTag CqlHostExchange::GET_HOST_BY_IPV6_SUBNET_ID_KEY;
constexpr StatementTag CqlHostExchange::GET_HOST_BY_IPV4_SUBNET_ID_PAGE;
constexpr StatementTag CqlHostExchange::GET_HOST_BY_IPV6_SUBNET_ID_PAGE;
constexpr StatementTag CqlHostExchange::GET_HOST_LIMIT;
"ALLOW FILTERING "
}},
- {GET_HOST_BY_IPV4_SUBNET_ID_KEY,
- {GET_HOST_BY_IPV4_SUBNET_ID_KEY,
- "SELECT "
- "key, "
- "id, "
- "host_identifier, "
- "host_identifier_type, "
- "host_ipv4_subnet_id, "
- "host_ipv6_subnet_id, "
- "host_ipv4_address, "
- "host_ipv4_next_server, "
- "host_ipv4_server_hostname, "
- "host_ipv4_boot_file_name, "
- "auth_key, "
- "hostname, "
- "user_context, "
- "host_ipv4_client_classes, "
- "host_ipv6_client_classes, "
- "reserved_ipv6_prefix_address, "
- "reserved_ipv6_prefix_length, "
- "reserved_ipv6_prefix_address_type, "
- "iaid, "
- "option_universe, "
- "option_code, "
- "option_value, "
- "option_formatted_value, "
- "option_space, "
- "option_is_persistent, "
- "option_client_class, "
- "option_subnet_id, "
- "option_user_context, "
- "option_scope_id "
- "FROM hosts "
- "WHERE key = ? "
- "ALLOW FILTERING "
- }},
-
{GET_HOST_BY_IPV4_SUBNET_ID_PAGE,
{GET_HOST_BY_IPV4_SUBNET_ID_PAGE,
"SELECT "
"ALLOW FILTERING "
}},
- {GET_HOST_BY_IPV6_SUBNET_ID_KEY,
- {GET_HOST_BY_IPV6_SUBNET_ID_KEY,
- "SELECT "
- "key, "
- "id, "
- "host_identifier, "
- "host_identifier_type, "
- "host_ipv4_subnet_id, "
- "host_ipv6_subnet_id, "
- "host_ipv4_address, "
- "host_ipv4_next_server, "
- "host_ipv4_server_hostname, "
- "host_ipv4_boot_file_name, "
- "auth_key, "
- "hostname, "
- "user_context, "
- "host_ipv4_client_classes, "
- "host_ipv6_client_classes, "
- "reserved_ipv6_prefix_address, "
- "reserved_ipv6_prefix_length, "
- "reserved_ipv6_prefix_address_type, "
- "iaid, "
- "option_universe, "
- "option_code, "
- "option_value, "
- "option_formatted_value, "
- "option_space, "
- "option_is_persistent, "
- "option_client_class, "
- "option_subnet_id, "
- "option_user_context, "
- "option_scope_id "
- "FROM hosts "
- "WHERE key = ? "
- "ALLOW FILTERING "
- }},
-
{GET_HOST_BY_IPV6_SUBNET_ID_PAGE,
{GET_HOST_BY_IPV6_SUBNET_ID_PAGE,
"SELECT "
virtual ConstHostCollection getHostCollectionPage6(uint64_t lower_host_id,
size_t count = 0) const;
- /// @brief Retrieves a host by key.
- ///
- /// @param key identifier of the host
- ///
- /// @return a host for the specific key
- virtual ConstHostPtr getHostByKey4(uint64_t key) const;
-
- /// @brief Retrieves a host by key.
- ///
- /// @param key identifier of the host
- ///
- /// @return a host for the specific key
- virtual ConstHostPtr getHostByKey6(uint64_t key) const;
-
/// @brief Retrieves a host by key.
///
/// @param key identifier of the host
return (result_collection);
}
-ConstHostPtr
-CqlHostDataSourceImpl::getHostByKey4(uint64_t key) const {
- // Bind to array.
- AnyArray where_values;
- cass_int64_t key_data = static_cast<cass_int64_t>(key);
- where_values.add(&key_data);
-
- // Run statement.
- ConstHostCollection collection =
- getHostCollection(CqlHostExchange::GET_HOST_BY_IPV4_SUBNET_ID_KEY,
- where_values);
-
- if (collection.empty()) {
- return (ConstHostPtr());
- }
-
- if (collection.size() >= 2u) {
- isc_throw(MultipleRecords, "CqlHostDataSourceImpl::getHost(): multiple records were "
- "found in the database where only one was expected for statement "
- << CqlHostExchange::GET_HOST_BY_IPV4_SUBNET_ID_KEY);
- }
-
- return (*collection.begin());
-}
-
-ConstHostPtr
-CqlHostDataSourceImpl::getHostByKey6(uint64_t key) const {
- // Bind to array.
- AnyArray where_values;
- cass_int64_t key_data = static_cast<cass_int64_t>(key);
- where_values.add(&key_data);
-
- // Run statement.
- ConstHostCollection collection =
- getHostCollection(CqlHostExchange::GET_HOST_BY_IPV6_SUBNET_ID_KEY,
- where_values);
-
- if (collection.empty()) {
- return (ConstHostPtr());
- }
-
- if (collection.size() >= 2u) {
- isc_throw(MultipleRecords, "CqlHostDataSourceImpl::getHost(): multiple records were "
- "found in the database where only one was expected for statement "
- << CqlHostExchange::GET_HOST_BY_IPV6_SUBNET_ID_KEY);
- }
-
- return (*collection.begin());
-}
-
ConstHostPtr
CqlHostDataSourceImpl::getHostByKey(uint64_t key) const {
// Bind to array.
break;
}
- ConstHostPtr host = getHostByKey4(key);
+ ConstHostPtr host = getHostByKey(key);
result_collection.push_back(host);
lower_host_id = host->getHostId();
}
break;
}
- ConstHostPtr host = getHostByKey6(key);
+ ConstHostPtr host = getHostByKey(key);
result_collection.push_back(host);
lower_host_id = host->getHostId();
}
break;
}
- ConstHostPtr host = getHostByKey6(key);
+ ConstHostPtr host = getHostByKey(key);
result_collection.push_back(host);
lower_host_id = host->getHostId();
}