Skip to content

MySQL_KeepResult

imshooter edited this page Oct 24, 2026 · 1 revision

Keep the result read after its public returns.

native Result:MySQL_KeepResult();

Returns

  • The kept result, which MySQL_UseResult reads again and MySQL_DestroyResult frees.
  • INVALID_RESULT_ID when no result is read.

Remarks

Inside the public of a query it keeps the result of that query. Outside, it keeps the result of the last MySQL_Run. Keeping a kept result while it is read gives its own id again. A kept result stays until it is destroyed or the script unloads.

Example

Keeps the list of houses read at start, to read it again later.

new Result:gHouses = INVALID_RESULT_ID;

forward OnHousesRead();

public OnHousesRead() {
    gHouses = MySQL_KeepResult();

    return 1;
}

stock GetHousePrice(index) {
    new
        price
    ;

    MySQL_UseResult(gHouses);
    price = MySQL_GetInt(index, "price");
    MySQL_UseResult(INVALID_RESULT_ID);

    return price;
}

Related

Clone this wiki locally