mysql_warning_count(3)
β¨ mysql_warning_count β¨
okay so bestie, we're in the MariaDB Connector/C section of the manual, and today's main character is mysql_warning_count β she's lowkey one of the most useful little functions you'll ever meet, no cap π
πΈ Name πΈ
mysql_warning_count β returns the number of warnings π«Ά
π Synopsis π
#include <mysql.h>
unsigned int mysql_warning_count(MYSQL * mysql);
π¦ Description π¦
So here's the vibe: she gives you back the number of warnings that came from the last executed query. That's it, that's the whole job. If there were no warnings at all? She hands you a zero and minds her business. β¨
π Parameter π
mysqlβ a mysql handle π«Ά and like, it has to be one that was already allocated bymysql_init(3)and then connected bymysql_real_connect(3). No random uninitialized handles, babe, that's not the move π
β Notes β
- Wanna actually read those warning messages, not just count them? You gotta use the SQL command
SHOW WARNINGS. Counting is one thing, reading the receipts is another π - And listen β if
SQL_MODE TRADITIONALis enabled, you get an error instead of a warning. Yes, really. For the detailed tea, go check the server documentation π
π Return value π
Returns the number of warnings β¨
π See also π
and that's the whole page, bestie π shoutout to Version 3.4 of the MariaDB Connector/C manual for bringing us this icon β she ate and left no crumbs, periodt π β¨π¦
π¦ 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