Skip to content

MySQL_RunBatch

imshooter edited this page Oct 24, 2026 · 1 revision

Send the rows of a batch and wait for them, as MySQL_Run does, and forget it.

native bool:MySQL_RunBatch(Batch:batch);

Parameters

Parameter Description
Batch:batch The batch.

Returns

  • true when it succeeded.
  • false when it failed, the batch or its statement does not exist, or a limit of the connection refused it.

Remarks

It waits as MySQL_Run does, so it suits saving everything when the server shuts down.

Example

new Statement:gSaveScore;

stock SaveScoresNow(const ids[]) {
    new const
        Batch:batch = MySQL_CreateBatch(gSaveScore)
    ;

    for (new i; i != MAX_PLAYERS; ++i) {
        if (IsPlayerConnected(i)) {
            MySQL_AddRow(batch, GetPlayerScore(i), ids[i]);
        }
    }

    return MySQL_RunBatch(batch);
}

Related

  • MySQL_ExecuteBatch: Send the rows of a batch after the queries sent before it, and forget it, also when it is refused.
  • MySQL_Run: Run a query and wait for it, after the queries sent before it.

Clone this wiki locally