Skip to content
imshooter edited this page Nov 29, 2026 · 1 revision

A failed query calls OnQueryError in the script that sent it, with the error of MySQL, its message, the public of the query and the start of the query. The public of the query is not called.

public OnQueryError(errorid, const error[], const callback[], const query[], MySQL:handle) {
    printf("Error %i in %s: %s", errorid, callback, error);

    return 1;
}

With ERROR_CALLBACK, an option of the connection, the public of a failed query is called too, after OnQueryError, with an empty cache. mysql_errno and cache_get_errno give the error inside it. Code that waits for a public, such as an inline, then always hears back.

mysql_errno and mysql_error give the last error of a handle, also of its connection after mysql_connect.

Lost connections

Every connection connects again when it is lost, half a second after the first failure and twice as long after each next one, up to five seconds. A query that runs while it cannot connect fails with the error of the connection.

Refused queries

A query past MAX_QUERY_LENGTH, MAX_PENDING or MAX_QUERIES_PER_SECOND is not sent, and the native returns false. A public that is not in the script, or a format that does not match the values, also makes the native return false, and a line is logged.

Home

Guides

Reference

Functions

Connections
Queries
Cache
JSON cells
ORM
Queries built in pieces
Prepared statements
Batches
Transactions
Passwords
Callbacks

Clone this wiki locally