nramenta / dabble

Lightweight wrapper and collection of helpers for MySQLi
MIT License
13 stars 4 forks source link

Support for MYSQLI_ASYNC #7

Open anoxic opened 7 years ago

anoxic commented 7 years ago

Some type of asynchronous support would be very great. Some options for a callback could also be interesting.

$db = new \Dabble\Database(/* ... */);
$request = $db->query_async("select id from table");
/* ... other things ... */
$result = $request->receive()->num_rows();

I would be willing to implement this. Do you have any thoughts here?

nramenta commented 7 years ago

I like your callback idea, seems interesting, although I'm not sure how you'd implement it.

anoxic commented 7 years ago

I was thinking with mysqli::poll, however thinking about it, that wouldn't really work unless we have some function that applies them at the end. I am not sure how much more useful this would be over just having query_async.

$db->query_callback($callable1, $query1);
$db->query_callback($callable2, $query2);
/* ... other things ... */
$db->apply_callbacks();