mysql_warning_count(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_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 by mysql_init(3) and then connected by mysql_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 TRADITIONAL is 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