mysql_errno(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_errno β€” bestie edition

okay so this is the manual page for mysql_errno from the MariaDB Connector/C library, and honestly? it's giving "short but essential." no cap. let's get into it 🫢


✨ Name ✨

mysql_errno β€” returns the last error code for the most recent function call. that's it. that's the whole job. she's simple, she's iconic, she tells you what went wrong πŸ’–


🌸 Synopsis 🌸

#include <mysql.h>

unsigned int mysql_errno(MYSQL * mysql);

like yes, that's the whole thing. she takes one pointer and hands you back an unsigned int. slay πŸ’…


πŸ¦‹ Description πŸ¦‹

so basically, mysql_errno() returns the last error code for the most recent function call that can succeed or fail. meaning: if the last thing you asked the library to do had the option of flopping, this is where you find out what kind of flop it was 😭

and here's the part bestie, listen up: zero means no error occurred. a 0 is not a code, it's a vibe check that you PASSED. periodt. ✨


πŸŽ€ Parameter πŸŽ€

  • mysql β€” a connection identifier, which was previously allocated by mysql_init(3) and connected by mysql_real_connect(3). so like, you can't just roll up with any random pointer, she needs a connection that's been properly set up first. main character energy only 🫢

πŸ’œ Notes πŸ’œ

  • client error codes are listed in the errmsg.h header file πŸ“„, and server error codes are listed in the mysqld_error.h header file of the server source distribution πŸ“„. so if you're staring at a number like "what does this MEAN," go look it up in one of those two files β€” client-side errors live in one, server-side errors live in the other. iykyk 🧚

🌈 See also 🌈

like the whole error-handling friend group. go read them too, they're obsessed with each other πŸ’–


lowkey reminder: 0 = all good, anything else = something happened and you should go read the code. no guessing, bestie, the header files are RIGHT THERE πŸ™ˆ

kisses, and remember β€” this is Version 3.4 of the MariaDB Connector/C manual, brought to you with so much love πŸ’œβœ¨ mwah πŸ’‹

πŸ“¦ where this page comes from