mysql_stmt_execute(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_execute πŸ’…

okay bestie, welcome to the MariaDB Connector/C manual, page for mysql_stmt_execute. this one's a baddie, let's get into it πŸŽ€


✨ Name ✨

mysql_stmt_execute β€” runs a prepared statement. like, actually sends it. the moment of truth. main character energy ✨


🌸 Synopsis 🌸

#include <mysql.h>

int mysql_stmt_execute(MYSQL_STMT * stmt);

πŸ¦‹ Description πŸ¦‹

so basically: this function executes a prepared statement that you already prepared earlier with mysql_stmt_prepare(3). think of prepare as "getting ready" and execute as "okay GO πŸƒβ™€οΈπŸ’¨".

and here's the cute part β€” when it executes, any parameter markers that exist get automatically replaced with the appropriate data. no cap, it just does it for you. you don't have to do the swap yourself, it handles the whole vibe.


πŸ“ Parameter πŸ“

  • stmt β€” a statement handle, which was previously allocated by mysql_stmt_init(3). yes, the handle from init. the origin story matters, bestie.

πŸ’– Return value πŸ’–

Returns zero on success, non-zero on failure.

so like… 0 is the slay outcome. anything else means something went sideways and you should go check. πŸ’€


πŸ‘‘ Notes πŸ‘‘

  • If the statement is UPDATE, REPLACE, DELETE or INSERT, the total number of affected rows can be determined by using the mysql_stmt_affected_rows(3) function. Likewise, if the query yields a result set the mysql_stmt_fetch(3) function is used.
so: affected-rows vibes β†’ mysql_stmt_affected_rows(3). result-set vibes β†’ mysql_stmt_fetch(3). know which one you're in, iykyk πŸ”₯

🌈 See Also 🌈


and that's the whole page, bestie 🫢 this was the MariaDB Connector/C manual, mysql_stmt_execute(3), Version 3.4. go execute something iconic πŸ’…βœ¨πŸ§š

πŸ“¦ where this page comes from