// SPDX-License-Identifier: GPL-3.0-or-later
#include "sqlite_health.h"
#include "sqlite_functions.h"
#include "sqlite_db_migration.h"
#include "health/health_internals.h"
#define MAX_HEALTH_SQL_SIZE 2048
#define SQLITE3_BIND_STRING_OR_NULL(res, param, key) \
((key) ? sqlite3_bind_text((res), (param), string2str(key), -1, SQLITE_STATIC) : sqlite3_bind_null((res), (param)))
#define SQLITE3_COLUMN_STRINGDUP_OR_NULL(res, param) \
({ \
int _param = (param); \
sqlite3_column_type((res), (_param)) != SQLITE_NULL ? \
string_strdupz((char *)sqlite3_column_text((res), (_param))) : \
NULL; \
})
/* Health related SQL queries
Updates an entry in the table
*/
#define SQL_UPDATE_HEALTH_LOG \
"UPDATE health_log_detail SET updated_by_id = @updated_by, flags = @flags, exec_run_timestamp = @exec_time, " \
"exec_code = @exec_code WHERE unique_id = @unique_id AND alarm_id = @alarm_id AND transition_id = @transaction"
static voi