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, INSERT or UPDATE statements
  • and the concrete number highkey depends on the database implementation πŸ‘€
  • like, MySQL doesn't give you the number of rows matched by the WHERE clause β€” 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