Book Image

Mastering MariaDB

By : Federico Razzoli
Book Image

Mastering MariaDB

By: Federico Razzoli

Overview of this book

Table of Contents (19 chapters)
Mastering MariaDB
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding error conditions in MariaDB


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 value

  • An 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.

The SQLSTATE value

The SQLSTATE value is an alphanumerical string of five characters. The first two characters represent a class and provide general information about the problem. The last three characters represent a subclass...