mariadb_cancel(3)
π mariadb_cancel β the "girl, we're SO done here" function π
okay bestie, welcome to mariadb_cancel(3) from the MariaDB Connector/C manual. yes we're in section 3, yes it's a library call, and yes it's about to make some queries β¨ regret everything β¨
π Name π
mariadb_cancel β immediately aborts a connection. like, no goodbye text, no "we need to talk", just blocked π
β¨ Synopsis β¨
#include <mysql.h>
int mariadb_cancel(MYSQL * mysql);
that's it. that's the whole vibe. one include, one function call, one very dramatic exit πͺπ¨
πΈ Description πΈ
okay so here's the tea, bestie π
mariadb_cancel() immediately aborts a connection by making all subsequent read/write operations fail. it's giving "blocked and deleted", it's giving "this conversation is over", it's giving main character exit. every read and every write after this? failed. done. not happening. π
BUT β and this is the important part, so listen up π β mariadb_cancel() does not invalidate the memory used for the mysql structure, and it does not close any communication channels. so the memory is still sitting there, being a lil freeloader, and the channels are still open. iconic of them honestly.
so if you actually wanna free that memory? you gotta call mysql_close(3). no cap. mariadb_cancel() is not the cleanup girl, she's the intervention girl.
and the way that mariadb_cancel() is useful is to break long queries in situations where sending KILL is not possible. like when KILL isn't even an option and you're just sitting there watching a query take forever, and you're like "bestie i cannot do this anymore". that's the moment. that's the function. π«Ά
π¦ Parameter π¦
mysqlβ the mysql handle π this lil guy was previously allocated bymysql_init(3)and connected bymysql_real_connect(3). so like, it's already had a whole journey before it gets here.
β Return value β
- Returns zero on success π
- Returns a non-zero value on error π
that's the whole vibe check. zero = slay. non-zero = not slay.
π History π
mariadb_cancel() was added in Connector/C 3.0. so she's not ancient, she's just β¨ established β¨
real talk though bestie: aborting a connection is a big deal. subsequent reads and writes will fail, and the memory is NOT freed until you call mysql_close(3). don't forget her, she's waiting π
Version 3.4 π mariadb_cancel(3) π and that's the whole page, bestie β go abort something (responsibly) π β¨π¦
π¦ 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