On Wed, 20 Mar 2024, Chris Angelico wrote:
On Wed, 20 Mar 2024 at 08:09, Henrik Grubbström (Lysator) @ Pike (-)
importmöte för mailinglistan <[email protected]> wrote:
Hey, folks.
Hi Mike.
We have a MySql database we need to connect to on this project, and
having trouble getting asynchronous requests to work.
[...]
Yes, the backend is running. I did some further tests and have found
that the PostgreSQL bindings work fine either synchronously or
asynchronously, and MySQL works synchronously, but not async.
Here's my test code, using async functions:
[...]
The final line of output here comes from printing out the promise
before awaiting it, but the query has already actually been run at
this point (the "Callback got" lines show the incoming data). This
isn't the case with the PostgreSQL bindings. It's possible something
in the MySQL bindings is operating synchronously.
Thanks for the report and test case.
Fixed in Pike master. It was due to the initialization order
in Sql.Promise::create().
Side note: Pike actually doesn't build against the latest MySQL due to
the removal of some ancient deprecated functions, so I have been using
the MariaDB client which is what ships with Debian anyway. They're
meant to be equivalent so I doubt this is the cause of the issue.
Please make a report at https://git.lysator.liu.se/pikelang/pike/.
/grubba
--
Henrik Grubbström [email protected]
Roxen Internet Software AB [email protected]