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

[#2869] Checkpoint: fixed MySQL

This commit is contained in:
Francis Dupont
2023-05-26 02:56:00 +02:00
parent fca0c45931
commit 1a5dacba0a

View File

@@ -4847,9 +4847,9 @@ MySqlLeaseMgr::byRelayId6size() const {
MYSQL_BIND bind[1];
memset(bind, 0, sizeof(bind));
int64_t result = 0;
int64_t count = 0;
bind[0].buffer_type = MYSQL_TYPE_LONGLONG;
bind[0].buffer = reinterpret_cast<char*>(&result);
bind[0].buffer = reinterpret_cast<char*>(&count);
int status = mysql_stmt_bind_result(ctx->conn_.statements_[stindex], &bind[0]);
checkError(ctx, status, stindex, "unable to bind SELECT clause parameters");
@@ -4860,12 +4860,17 @@ MySqlLeaseMgr::byRelayId6size() const {
checkError(ctx, status, stindex, "unable to execute");
}
status = mysql_stmt_store_result(ctx->conn_.statements_[stindex]);
checkError(ctx, status, stindex, "unable to store result");
// Fetch the result.
MySqlFreeResult fetch_release(ctx->conn_.statements_[stindex]);
status = mysql_stmt_fetch(ctx->conn_.statements_[stindex]);
if (status != 0) {
checkError(ctx, status, stindex, "unable to fetch results");
}
return(result);
return (static_cast<size_t>(count));
}
size_t
@@ -4880,9 +4885,9 @@ MySqlLeaseMgr::byRemoteId6size() const {
MYSQL_BIND bind[1];
memset(bind, 0, sizeof(bind));
int64_t result = 0;
int64_t count = 0;
bind[0].buffer_type = MYSQL_TYPE_LONGLONG;
bind[0].buffer = reinterpret_cast<char*>(&result);
bind[0].buffer = reinterpret_cast<char*>(&count);
int status = mysql_stmt_bind_result(ctx->conn_.statements_[stindex], &bind[0]);
checkError(ctx, status, stindex, "unable to bind SELECT clause parameters");
@@ -4893,12 +4898,17 @@ MySqlLeaseMgr::byRemoteId6size() const {
checkError(ctx, status, stindex, "unable to execute");
}
status = mysql_stmt_store_result(ctx->conn_.statements_[stindex]);
checkError(ctx, status, stindex, "unable to store result");
// Fetch the result.
MySqlFreeResult fetch_release(ctx->conn_.statements_[stindex]);
status = mysql_stmt_fetch(ctx->conn_.statements_[stindex]);
if (status != 0) {
checkError(ctx, status, stindex, "unable to fetch results");
}
return(result);
return (static_cast<size_t>(count));
}
} // namespace dhcp