mirror of
https://github.com/fluffos/fluffos
synced 2026-08-12 18:26:06 -04:00
resolve(), async_read(), async_write(), async_getdir() and async_db_exec() ran their callbacks with no user context, so this_player() returned 0 and input_to()/printf() were unusable there. Follow the call_out() precedent: capture command_giver (ref-held) when the request is registered and restore it around the callback, skipping destructed objects, gated on the same 'this_player in call_out' setting. The pending-request holders account for the new ref in the DEBUGMALLOC walkers. The new test registers callbacks from two different living objects and asserts each callback sees its own registrant, which fails without the per-request capture. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lv2Gw2AWqtyN3nNEgob1He
957 B
957 B
| title |
|---|
| async / async_db_exec |
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)