Before discussing the database debugging techniques, it is important to understand the most important tools used by MariaDB that notify us about error conditions, that is, when something goes wrong.
An error in MariaDB consists of the following types of data:
A
SQLSTATE
valueAn error number
An error message
While conditions are usually generated by the server, the user can raise them using the SIGNAL
and RESIGNAL
SQL statements.
To get information about errors, the C API provides three methods: mysql_sqlstate()
, mysql_errno()
, and mysql_error()
. Most MariaDB or MySQL APIs have corresponding methods with almost identical names. These methods and statements will be discussed later in this chapter. Now, let's discuss the MariaDB errors.