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

[#2438] add MySqlLeaseMgr::isJsonSupported()

This commit is contained in:
Andrei Pavel
2022-06-21 22:42:46 +03:00
parent a7508e973d
commit 14edcab6a9
11 changed files with 85 additions and 1 deletions

View File

@@ -329,6 +329,7 @@ tagged_statements = { {
// TODO: remove single quotes from the following two SELECTs when the functions are implemented
{MySqlLeaseMgr::CHECK_LEASE4_LIMITS, "SELECT 'checkLease4Limits(?)'"},
{MySqlLeaseMgr::CHECK_LEASE6_LIMITS, "SELECT 'checkLease6Limits(?)'"},
{MySqlLeaseMgr::IS_JSON_SUPPORTED, "SELECT isJsonSupported()"},
} }; // tagged_statements
} // namespace
@@ -3278,6 +3279,28 @@ 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