mysql_stmt_close(3)
π mysql_stmt_close(3) π
okay bestie, welcome to the MariaDB Connector/C manual β this one's all about putting your prepared statement to bed ποΈβ¨
πΈ Name πΈ
mysql_stmt_close β closes a prepared statement. that's it, that's the whole vibe. it's the goodbye function π«Ά
β¨ Synopsis β¨
#include <mysql.h>
my_bool mysql_stmt_close(MYSQL_STMT * stmt);
look at that signature. clean. iconic. no notes. π
π Description π
so like, this function closes a prepared statement and deallocates the statement handle. meaning: once you call it, that handle is gone, deceased, no longer with us, we said our goodbyes π¦
and here's the part that's lowkey important β if the current statement has pending or unread results, this function cancels them so that the next query can be executed. so it's not just a polite wave, it's a full cleanup. the leftovers get swept, the runway is clear, and your next query can take off βοΈβ¨
π Parameter π
stmtβ a statement handle, which was previously allocated bymysql_stmt_init(3). like, this has to be a handle thatmysql_stmt_init(3)made for you. you can't just bring a random pointer to the function and expect it to slay π
π Return value π
- Returns zero on success β
- nonzero on error β specifically when communicating with the server π
and here's the caveat, bestie, so listen up: the statement is deallocated, regardless of the error. so even if the server comms go sideways, that handle is still gone. don't go reusing it afterward, it's not coming back π
π¦ Notes π¦
- If you want to reuse the statement handle with a different SQL command, use
mysql_stmt_reset(3)β that's the refresh button, this function is the close tab button. know the difference, it's giving main character energy β¨
π See Also π
and that's the whole page, bestie!! this was Version 3.4 of the MariaDB Connector/C manual, so if you ever need to cite it: version 3.4, mysql_stmt_close(3), MariaDB Connector/C π now go forth and close your statements responsibly, iykyk ππΈβ¨
π¦ 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