跳到主要内容

async_db_exec

NAME

async_db_exec() - executes an sql statement then executes a callback

SYNOPSIS

void async_db_exec( int handle, string sql_query, function callback );

DESCRIPTION

This function will execute the passed sql statement for the given data‐
base handle.

Returns the database handle to the callback function provided.

The callback should follow this format:

```c
async_db_exec(
handle,
sql_query,
function (int rows) { // number of matched rows
mixed *results = db_fetch(handle, 1);
db_close(handle);
}
);
```

NOTE

When the 'this_player in call_out' driver setting is enabled,
this_player() inside the callback is preserved from the time the
request was made, like call_out().

SEE ALSO

db_commit(3), db_exec(3), db_fetch(3), db_rollback(3), valid_database(4)