mysql_fetch_row(3)

πŸ“¦
version 13.0.2 Β· 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ mysql_fetch_row ✨

okay bestie, so we're in the MariaDB Connector/C section of the manual β€” this is mysql_fetch_row(3), and she's literally the girl who hands you your data one row at a time πŸ’…


🌸 NAME 🌸

mysql_fetch_row β€” fetches row of data from result set 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <mysql.h>

MYSQL_ROW mysql_fetch_row(MYSQL_RES * result);

πŸ’– DESCRIPTION πŸ’–

So basically: this function fetches one row of data from the result set and returns it as an array of char pointers (MYSQL_ROW), where each column is stored in an offset starting from 0 (zero). no cap, zero-indexed, that's just the vibe 🌈

And the way that every subsequent call to this function will return the next row within the result set? iconic. and when there are no more rows left to give you, she returns NULL. periodt πŸ’€


πŸ¦‹ PARAMETER πŸ¦‹


πŸ‘‘ NOTES πŸ‘‘

  • If a column contains a NULL value, the corresponding char pointer will be set to NULL. so like, don't be shocked when you see it, it's giving intentional 🌸
  • Memory associated to MYSQL_ROW will be freed when calling mysql_free_result(3). so do NOT go freeing it yourself bestie, let the function do her thing πŸ™ˆ

⭐ RETURN VALUE ⭐

A MYSQL_ROW structure (array of character pointers) representing the data of the current row. and if there are no more rows available, NULL will be returned. that's the whole deal, main character energy fr fr πŸ’œ


🌈 SEE ALSO 🌈


ok so quick recap bestie: call her in a loop, she gives you rows, she says NULL when she's done, and mysql_free_result(3) handles the cleanup. obsessed 🫢✨

Version 3.4 β€” that's the tea, mwah πŸ’‹ go read some rows, you ate πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from