mysql_fetch_lengths(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_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 πŸŽ€

πŸ¦‹ 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