2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-01 06:25:34 +00:00

[#2445] implement PostgreSQL lease manager methods for limit checking

This commit is contained in:
Andrei Pavel
2022-06-27 11:08:33 +03:00
parent 91a644d032
commit f5419843a1
4 changed files with 68 additions and 55 deletions

View File

@@ -3135,6 +3135,28 @@ MySqlLeaseMgr::checkLimits6(ConstElementPtr const& user_context) const {
return checkLimits(user_context, CHECK_LEASE6_LIMITS);
}
bool
MySqlLeaseMgr::isJsonSupported() const {
// Get a context.
MySqlLeaseContextAlloc get_context(*this);
MySqlLeaseContextPtr ctx = get_context.ctx_;
// Create bindings.
MySqlBindingCollection in_bindings;
MySqlBindingCollection out_bindings({
MySqlBinding::createBool()
});
// Execute the select.
bool json_supported(false);
ctx->conn_.selectQuery(IS_JSON_SUPPORTED, in_bindings, out_bindings,
[&json_supported] (MySqlBindingCollection const& result) {
json_supported = result[0]->getBool();
});
return json_supported;
}
LeaseStatsQueryPtr
MySqlLeaseMgr::startLeaseStatsQuery4() {
// Get a context
@@ -3231,28 +3253,6 @@ MySqlLeaseMgr::wipeLeases6(const SubnetID& /*subnet_id*/) {
isc_throw(NotImplemented, "wipeLeases6 is not implemented for MySQL backend");
}
bool
MySqlLeaseMgr::isJsonSupported() const {
// Get a context.
MySqlLeaseContextAlloc get_context(*this);
MySqlLeaseContextPtr ctx = get_context.ctx_;
// Create bindings.
MySqlBindingCollection in_bindings;
MySqlBindingCollection out_bindings({
MySqlBinding::createBool()
});
// Execute the select.
bool json_supported(false);
ctx->conn_.selectQuery(IS_JSON_SUPPORTED, in_bindings, out_bindings,
[&json_supported] (MySqlBindingCollection const& result) {
json_supported = result[0]->getBool();
});
return json_supported;
}
// Miscellaneous database methods.
std::string