mysql_fetch_lengths(3)
β¨ mysql_fetch_lengths β returns an array of length values for the current row β¨
okay bestie, welcome to MariaDB Connector/C and specifically the mysql_fetch_lengths(3) page π buckle up, it's a short one but it's lowkey iconic.
πΈ SYNOPSIS πΈ
#include <mysql.h>
unsigned long * mysql_fetch_lengths(MYSQL_RES * result);
that's it. that's the whole vibe. one function, one argument, one pointer to an array of lengths π«Ά
π DESCRIPTION π
so mysql_fetch_lengths() hands you back an array that contains the lengths of every column of the current row inside the result set β and ngl, these lengths do not include the terminating zero character, okay, that's important, don't come for me.
if something goes wrong? you get NULL. that's the error signal, periodt π
π PARAMETER π
resultβ a result set identifier, and you get it frommysql_store_result(3)ormysql_use_result(3). that's the plug, that's where it comes from π
π¦ Notes π¦
fr fr, listen up: mysql_fetch_lengths() is valid only for the current row of the result set. that's the whole rule. it returns NULL if you call it before calling mysql_fetch_row(3), or after you've already retrieved all the rows in the result. so likeβ¦ timing is everything, main character energy only applies to the current row π
β οΈ no current row, no lengths. NULL is the answer and it is not the answer you want.
β RETURN VALUE β
an array of unsigned long values β¨
and how big is that array, you ask? it's determined by the number of fields in the current result set. so peek at your field count and you'll know exactly how many lil length values you're holding. slay π
π SEE ALSO π
go read those too, they're the besties of this function, iykyk π§
Version 3.4 of the MariaDB Connector/C man pages, bestie β that's the whole page, thanks for coming to my ted talk, now go fetch some lengths πβ¨π
π¦ 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