mysql_sqlstate(3)
π mysql_sqlstate π
okay so bestie, we're in the MariaDB Connector/C manual, and this one is literally so handy β it's mysql_sqlstate, the girl who tells you what went wrong, in that fancy five-character SQLSTATE language β¨
β¨ Name β¨
mysql_sqlstate β returns the SQLSTATE error code π
β¨ Synopsis β¨
#include <mysql.h>
const char * mysql_sqlstate(MYSQL * mysql);
β¨ Description β¨
So here's the tea π β mysql_sqlstate() hands you back a string holding the SQLSTATE error code for the most recently invoked function that can succeed or fail. That's it, that's the whole vibe.
The error code is five characters long, no more no less. And the iconique one: 00000 means no error β like, we're fine, we're thriving, nothing to see here π
The values themselves are specified by ANSI SQL and ODBC. iykyk.
β¨ Parameter β¨
(fr fr there's nothing listed under this heading in the original β the parameter lives in the synopsis above, bestie π«Ά)
β¨ Notes β¨
okay important thing, don't come for me: not all client library error codes are mapped to SQLSTATE errors π
Any error that can't be mapped gets returned as the value HY000. So if you see HY000, that's the "we don't have a cute name for this one" bucket πͺ£β¨
β¨ Return value β¨
A string containing the SQLSTATE error code. periodt π
β¨ See also β¨
mysql_error(3)πΈmysql_errno(3)πΈ
Version 3.4 β and that's the whole page, bestie, go forth and debug with main character energy ππβ¨ slay π¦
π¦ 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