odbx_rows_affected(3)
π odbx_rows_affected(3) β the OpenDBX manual, bestie edition
okay so this is the page for odbx_rows_affected from the OpenDBX manual, section 3 (library calls, iykyk). it tells you how many rows actually got changed. let's go π«Ά
β¨ NAME β¨
odbx_rows_affected β returns the number of changed records π«
πΈ SYNOPSIS πΈ
#include <opendbx/api.h>
uint64_t odbx_rows_affected (odbx_result_t* result);
π¦ DESCRIPTION π¦
So basically this function hands you back the number of rows that got changed by the current statement β the one whose result set you already grabbed with odbx_result(). β¨
important deets, no cap:
- affected rows are only returned for
DELETE,INSERTorUPDATEstatements - and the concrete number highkey depends on the database implementation π
- like, MySQL doesn't give you the number of rows matched by the
WHEREclause β it only counts the rows whose values have really been changed. so it can lowkey undercount compared to what you'd expect.
and the result parameter? it must be a valid result set returned by odbx_result(), and it must not have been fed to odbx_result_finish() before. π« like, don't finish it and then come back asking questions, that's not the vibe.
π RETURN VALUE π
odbx_rows_affected() returns the number of changed rows on success π
it returns zero if:
- the database server didn't alter any rows
- the statement doesn't match any rows at all
π¨ also a heads-up: some database servers like MySQL may return a lower number than you expected, because they don't modify records whose values wouldn't change. so if the number looks small, that's why, not a bug on your end. bestie it's just built like that π
π ERRORS π
this function will also return zero if the result parameter is invalid. yep. same zero. so zero is doing double duty here β it means "nothing changed" and "you gave me garbage". iconique but frustrating π
π SEE ALSO π
odbx_result()odbx_result_finish()
π that's the whole page bestie, go forth and count your rows
kisses, and remember: OpenDBX, odbx_rows_affected(3), dated 6 February 2026 β that's the source/version vibe and the date, mwah π
β¨
π¦ where this page comes from
- ubuntu resolute: libopendbx1-dev 1.4.6-18build2
- ubuntu stonking: libopendbx1-dev 1.4.6-18build2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms