odbx_column_count(3)

πŸ’… odbx_column_count(3) β€” the OpenDBX girlies' guide

okay so bestie, welcome to odbx_column_count, one of the OpenDBX crew ✨ if you've ever stared at a result set and gone "how many columns is this actually giving…" β€” this is the function for you. no cap. πŸŽ€


🌸 NAME 🌸

odbx_column_count β€” get the number of columns in the current result set πŸ’–


✨ SYNOPSIS ✨

#include <opendbx/api.h>

int odbx_column_count (odbx_result_t* result);

like, that's the whole vibe. one include, one call. slay. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So odbx_column_count() returns the number of columns that belong to the current result set β€” the one you already allocated with odbx_result(). 🫢

And here's the tea: that number will never change within a result set… with one notable exception. πŸ‘€

🚨 The MySQL exception, fr fr: MySQL returns all the outstanding rows of a previous result set first if they weren't fetched completely by odbx_row_fetch() before. So yeah β€” in this special situation the column count might change. not a drill. 😭

Because of that, it is strongly advised to fetch all rows of a result set before calling odbx_result() again β€” because other backends will straight up return an error in this case. no vibes, just error. πŸ’€

Also, the result parameter this function needs 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 ghost it and then come back. πŸ™ˆ


πŸ”₯ RETURN VALUE πŸ”₯

odbx_column_count() returns the number of columns/fields available in the current result set. πŸ‘‘

The value depends on the column list that's part of the SELECT query, and it is zero if the query wasn't a SELECT-like query. yeah. zero. it's giving "nothing to see here". ⭐


πŸ’€ ERRORS πŸ’€

This function will also return zero if the result parameter is invalid. so if you get a zero and you're confused… check your result, bestie. πŸ“


🌈 SEE ALSO 🌈

  • odbx_column_name()
  • odbx_column_type()
  • odbx_result()

the whole squad. iykyk. 🧚


mwah πŸ’‹ that's it, that's the page β€” brought to you by OpenDBX, dated 6 February 2026. go forth and count those columns, icon. πŸ¦‹βœ¨πŸ‘‘
πŸ“¦ where this page comes from