Skip to content

MySQL_Execute

imshooter edited this page Oct 24, 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_Execute(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_Query: 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_Execute(gFindPlayer, "OnPlayerFound", playerid, name);

    return 1;
}

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

    return 1;
}

Related

  • MySQL_Prepare: Prepare a statement, with a specifier for each value.
  • MySQL_RunStatement: Run a statement once and wait for it, as MySQL_Run does.
  • MySQL_Query: Send a query, and call a public with context when it is done.

Clone this wiki locally