Skip to content

MySQL_ExecuteStatement

imshooter edited this page Oct 31, 2026 · 1 revision

Run a statement once, after the queries sent before it.

Inside the public, the result is the one the MySQL_Get natives read, as for a query.

native bool:MySQL_ExecuteStatement(Statement:statement, const callback[] = "", context = 0, MYSQL_TAGS:...);

Parameters

Parameter Description Default
Statement:statement The statement.
const callback[] Public to call when it is done, or none. ""
context Value the public receives. 0
MYSQL_TAGS:... A value for each specifier.

Returns

  • true when it was sent.
  • false when the statement does not exist, the values do not match it, or a limit of the connection refused it.

Remarks

It runs after the queries and statements sent before it, and its public behaves as the one of MySQL_ThreadedQuery: results are read with the same natives. The values are copied when it is called, so the arrays they came from can change at once.

The values must match the specifiers of the statement in number, or nothing is sent.

Example

new Statement:gFindPlayer;

forward OnPlayerFound(playerid);

public OnPlayerConnect(playerid) {
    new
        name[MAX_PLAYER_NAME + 1]
    ;

    GetPlayerName(playerid, name, sizeof (name));
    MySQL_ExecuteStatement(gFindPlayer, "OnPlayerFound", playerid, name);

    return 1;
}

public OnPlayerFound(playerid) {
    if (MySQL_GetRowCount() != 0) {
        SetPlayerScore(playerid, MySQL_GetInt(0, "score"));
    }

    return 1;
}

Related

Clone this wiki locally