Repository navigation
MySQL_ParallelQuery
imshooter edited this page Oct 24, 2026
·
1 revision
Send a query that any connection of the pool may run, out of order with the rest.
Without a pool, it runs in order as MySQL_Query does.
native bool:MySQL_ParallelQuery(
MySQL:handle,
const callback[],
context,
const query[],
MYSQL_TAGS:...
);| Parameter | Description |
|---|---|
MySQL:handle |
Handle to send it through. |
const callback[] |
Public to call. |
context |
Value the public receives. |
const query[] |
The query, formatted with the values after it. |
MYSQL_TAGS:... |
Values for the specifiers of the query, in order. |
-
truewhen it was sent. -
falsewhen the handle does not exist, the format is not valid, or a limit of the connection refused it, and the public is not called.
The pool is set with the pool option of the handle. Without a pool the query runs in order with the rest. A parallel query may finish before a query sent earlier, so it suits reads that do not depend on writes still waiting, such as a list for a menu or a ranking.
new MySQL:gDatabase;
forward OnRankingRead(playerid);
stock ShowRanking(playerid) {
MySQL_ParallelQuery(gDatabase, "OnRankingRead", playerid, "SELECT name, score FROM players ORDER BY score DESC LIMIT 10");
}
public OnRankingRead(playerid) {
new
name[MAX_PLAYER_NAME + 1]
;
for (new row, rows = MySQL_GetRowCount(); row != rows; ++row) {
MySQL_GetString(row, "name", name);
SendClientMessage(playerid, -1, "%i. %s, %i", row + 1, name, MySQL_GetInt(row, "score"));
}
return 1;
}-
MySQL_Query: Send a query, and call a public with
contextwhen it is done. - MySQL_Connect: Connect to a database.
MySQL 0.2.0 · Repository · Releases · MIT License
Guides
- Installation
- Configuration
- Queries
- Results
- JSON cells
- Prepared statements
- Passwords
- Errors
- TLS
- Coming from R41
- Performance
Reference
Functions