mysql_stmt_bind_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_stmt_bind_result β€” MariaDB Connector/C πŸ’–

okay bestie, pull up a chair, because this one is literally the glue that makes your result set usable 🫢

✨ Name ✨

mysql_stmt_bind_result β€” she binds result columns to variables. that's the whole job. that's the vibe. πŸ’…


🌸 Synopsis 🌸

#include <mysql.h>

my_bool mysql_stmt_bind_result(MYSQL_STMT * stmt,
                               MYSQL_BIND * bind);

πŸ¦‹ Description πŸ¦‹

okay so here's the tea: this function binds the columns in the result set to variables. you're basically telling the connector "hey, when you fetch stuff, put it here" and it says "bet" πŸ’–

Returns zero on success, non-zero on failure. no cap.


πŸŽ€ Parameters πŸŽ€

  • stmt β€” a statement handle, which was previously allocated by mysql_stmt_init(3). like, she needs to already exist, you can't just manifest her out of thin air. ✨
  • bind β€” an array of [MYSQL_BIND]] structures. and listen, the size of this array must be equal to the number of columns in result set. not more, not less, it's giving exact match energy πŸ‘‘

πŸ‘‘ Notes πŸ‘‘

  • to figure out the number of columns in the result set, use mysql_stmt_field_count(3). she will tell you. πŸ”₯
  • a column can be bound or rebound at any time, even after a result set has been partially retrieved. the new binding takes effect the next time mysql_stmt_fetch(3) is called. so like, you can change your mind mid-fetch and that's iconic of you, the new binding just won't kick in until the next mysql_stmt_fetch(3) call. periodt. πŸ’…

🌈 See Also 🌈


fr fr, go read those three, they're the besties this function runs with 🧚

and that's the whole page, bestie, go bind some results and slay πŸ’œ

Version 3.4 of the MariaDB Connector/C manual, page mysql_stmt_bind_result(3) β€” mwah, love that for us πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from