Re: Promises and MySql seem to not return

Henrik Grubbström <[email protected]> Wed, 20 Mar 2024 11:30:53 +0100 (CET)
Newsgroups gmane.comp.lang.pike.user
Organization Roxen Internet Software AB
Message-ID <[email protected]>
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--8323328-1244509123-1710930653=:6005
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8BIT

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]
--8323328-1244509123-1710930653=:6005--