mysql_fetch_row(3)
β¨ 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 π¦
resultβ a result set identifier returned bymysql_store_result(3)ormysql_use_result(3). that's it, that's the whole parameter, she's lowkey simple π
π NOTES π
- If a column contains a
NULLvalue, the correspondingcharpointer will be set toNULL. so like, don't be shocked when you see it, it's giving intentional πΈ - Memory associated to
MYSQL_ROWwill be freed when callingmysql_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 saysNULLwhen she's done, andmysql_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
- alpine 3.22: mariadb-doc 11.4.13-r0 Β· GPL-2.0-or-later
- alpine 3.23: mariadb-doc 11.4.13-r0 Β· GPL-2.0-or-later
- alpine 3.24: mariadb-doc 11.8.9-r0 Β· GPL-2.0-only
- arch rolling: mariadb 13.0.2-2 Β· GPL-2.0-only
- arch rolling: mariadb-lts 12.3.3-2 Β· GPL-2.0-only
- centos-stream 10: mariadb-connector-c-doc 3.4.4-2.el10 Β· LGPL-2.1-or-later
- debian trixie: libmariadb-dev 1:11.8.6-0+deb13u1 Β· GPL-2.0-only
- fedora 43: mariadb-connector-c-doc 3.4.5-2.fc43 Β· LGPL-2.1-or-later AND PHP-3.0 AND PHP-3.01
- fedora 43: mariadb-connector-c-doc 3.4.9-2.fc43 Β· LGPL-2.1-or-later AND PHP-3.0 AND PHP-3.01 AND LicenseRef-Fedora-Public-Domain
- fedora 44: mariadb-connector-c-doc 3.4.8-3.fc44 Β· LGPL-2.1-or-later AND PHP-3.0 AND PHP-3.01
- fedora 44: mariadb-connector-c-doc 3.4.9-2.fc44 Β· LGPL-2.1-or-later AND PHP-3.0 AND PHP-3.01 AND LicenseRef-Fedora-Public-Domain
- nixpkgs unstable: mariadb-server 11.8.8
- opensuse-leap 16.0: libmariadb-devel 3.4.9-160000.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libmariadb-devel 3.4.9-160000.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libmariadb-devel 3.4.9-160000.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libmariadb-devel 3.4.9-160000.1.1 Β· LGPL-2.1-or-later
- ubuntu questing: libmariadb-dev 1:11.8.3-1build1
- ubuntu resolute: libmariadb-dev 1:11.8.6-5 Β· GPL-2.0-only
- ubuntu resolute: libmariadb-dev 1:11.8.6-5ubuntu0.1 Β· GPL-2.0-only
- ubuntu stonking: libmariadb-dev 1:11.8.9+ds-4ubuntu2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms