diff options
author | Jeremy Sowden <jeremy@azazel.net> | 2023-08-21 20:42:35 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2023-09-14 14:22:49 +0200 |
commit | 40517221e15e7518980b582cecf290bc5880064e (patch) | |
tree | 37e4d7e4cf3385ef1d2af8688c5b47ed1b648f16 /output/sqlite3/ulogd_output_SQLITE3.c | |
parent | c6b8755b29e9dd4067a4c9031226f214af8ead30 (diff) |
sqlite3: correct binding of ipv4 addresses and 64-bit integers
Hitherto we have bound ipv4 addresses as 64-bit ints and 64-bit ints as
32-bit.
Move a `ULOGD_RET_BOOL` case for consistency and fix some nearby
formatting.
Fix some nearby formatting.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'output/sqlite3/ulogd_output_SQLITE3.c')
-rw-r--r-- | output/sqlite3/ulogd_output_SQLITE3.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/output/sqlite3/ulogd_output_SQLITE3.c b/output/sqlite3/ulogd_output_SQLITE3.c index 0a9ad67..3a82389 100644 --- a/output/sqlite3/ulogd_output_SQLITE3.c +++ b/output/sqlite3/ulogd_output_SQLITE3.c @@ -145,6 +145,10 @@ sqlite3_interp(struct ulogd_pluginstance *pi) } switch (f->key->type) { + case ULOGD_RET_BOOL: + ret = sqlite3_bind_int(priv->p_stmt, i, k_ret->u.value.b); + break; + case ULOGD_RET_INT8: ret = sqlite3_bind_int(priv->p_stmt, i, k_ret->u.value.i8); break; @@ -158,7 +162,7 @@ sqlite3_interp(struct ulogd_pluginstance *pi) break; case ULOGD_RET_INT64: - ret = sqlite3_bind_int(priv->p_stmt, i, k_ret->u.value.i64); + ret = sqlite3_bind_int64(priv->p_stmt, i, k_ret->u.value.i64); break; case ULOGD_RET_UINT8: @@ -174,17 +178,16 @@ sqlite3_interp(struct ulogd_pluginstance *pi) break; case ULOGD_RET_IPADDR: - case ULOGD_RET_UINT64: - ret = sqlite3_bind_int64(priv->p_stmt, i, k_ret->u.value.ui64); + ret = sqlite3_bind_int(priv->p_stmt, i, k_ret->u.value.ui32); break; - case ULOGD_RET_BOOL: - ret = sqlite3_bind_int(priv->p_stmt, i, k_ret->u.value.b); + case ULOGD_RET_UINT64: + ret = sqlite3_bind_int64(priv->p_stmt, i, k_ret->u.value.ui64); break; case ULOGD_RET_STRING: ret = sqlite3_bind_text(priv->p_stmt, i, k_ret->u.value.ptr, - strlen(k_ret->u.value.ptr), SQLITE_STATIC); + strlen(k_ret->u.value.ptr), SQLITE_STATIC); break; default: |