mysql_use_result(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_use_result β€” bestie edition ✨

okay so this is a page from the MariaDB Connector/C manual, and it's about mysql_use_result(3) πŸ’– literally the function you call when you want your result set unbuffered, no cap.


πŸŽ€ NAME πŸŽ€

mysql_use_result β€” returns an unbuffered result set. that's the whole vibe. ✨


🌸 SYNOPSIS 🌸

#include <mysql.h>

MYSQL_RES * mysql_use_result(MYSQL * mysql);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie πŸ«– β€” you use this to initiate the retrieval of a result set from the last query you ran with mysql_real_query() on that database connection.

and listen, you gotta pick one: either this function or mysql_store_result(3) β€” one of them, no skipping, fr fr. Because you literally can't pull the results of a query without one of them. and if you call neither?? the next query on that same database connection is gonna fail 😭 so don't do that to yourself.


πŸ’… PARAMETERS πŸ’…

  • mysql β€” your connection identifier, aka the little guy you already made with mysql_init(3) and then actually hooked up with mysql_real_connect(3). she's your main character connection πŸ‘‘

⭐ NOTES ⭐

okay important part, pay attention 🫢

mysql_use_result() does not transfer the entire result set. it's giving "streaming, not hoarding." and because of that, several functions like mysql_num_rows(3) or mysql_data_seek(3) cannot be used. so don't try, she will not be answering πŸ’€

also, mysql_use_result() will block the current connection until all result sets are retrieved, or the result set gets released by mysql_free_result(3). so yeah, that connection is busy being booked and blessed until you're done with her 🧚


πŸ”₯ RETURN VALUE πŸ”₯

returns an unbuffered result set, or NULL if an error occurred. (if you get NULL, that's your vibe check failing, sorry bestie πŸ™ˆ)


🌈 SEE ALSO 🌈


Version 3.4 of the MariaDB Connector/C docs, babes β€” that's a wrap, go forth and retrieve your result sets responsibly, mwah πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from