Promises and MySql seem to not return

Mike Kilmer <[email protected]> Tue, 19 Mar 2024 12:26:06 -0500
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
--Apple-Mail=_D6831569-CCEF-4E99-BF65-150783C520A7
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Hey, folks.

We have a MySql database we need to connect to on this project, and =
having trouble getting asynchronous requests to work.

If we use `dbconn->typed_query`, we get the expected response.

With promise_query, seeing: `SQL status: still running...`

Chris Angelico promises (pun intended) to pry further into it, and I =
hope you don't mind more spam from me in the meantime.

mixed q =3D dbconn->promise_query("select 1 from dual");
werror("Promise: %O\n", q);
mixed result =3D await(q);
werror("Result: %O\n", result);
werror("Rows: %O\n", result->get());
}

WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a =
future version.
Query result: ({ /* 1 element */
    ([ /* 1 element */
      "1": 1
    ])
})
Create future mysql(/*mysql-test.gotagtech.com via TCP/IP*/) "select 1 =
from dual" 0
Create future result mysql(/*mysql-test.gotagtech.com via TCP/IP*/) =
"select 1 from dual" 0
Callback got ({ /* 1 element */
    ({ /* 1 element */
        1
    })
})
Callback got 0
Future succeeded "select 1 from dual"
Promise: __builtin.Sql.Promise(no

Promise: __builtin.Sql.Promise(no future,FutureResult from query: =
"select 1 from dual", bindings: 0
recordcount: 1
SQL status: still running...)

Thanks much and have a good and great one.

Mike=

--Apple-Mail=_D6831569-CCEF-4E99-BF65-150783C520A7
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;"><div>Hey, =
folks.</div><div><br></div><div>We have a MySql database we need to =
connect to on this project, and having trouble getting asynchronous =
requests to work.</div><div><br></div><div>If we use `<span =
style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, =
0);">dbconn-&gt;typed_query`, we get the expected =
response.</span></div><div><span style=3D"caret-color: rgb(0, 0, 0); =
color: rgb(0, 0, 0);"><br></span></div><div><span style=3D"caret-color: =
rgb(0, 0, 0); color: rgb(0, 0, 0);">With promise_query, seeing: =
`</span><span style=3D"caret-color: rgb(32, 33, 36); color: rgb(32, 33, =
36); font-family: Roboto, arial, sans-serif; font-size: 13px; orphans: =
2; white-space: pre-wrap; widows: 2; background-color: rgb(255, 255, =
255);">SQL status: still running...`</span></div><div><span =
style=3D"caret-color: rgb(32, 33, 36); color: rgb(32, 33, 36); =
font-family: Roboto, arial, sans-serif; font-size: 13px; orphans: 2; =
white-space: pre-wrap; widows: 2; background-color: rgb(255, 255, =
255);"><br></span></div><div><span style=3D"caret-color: rgb(32, 33, =
36); color: rgb(32, 33, 36); font-family: Roboto, arial, sans-serif; =
font-size: 13px; orphans: 2; white-space: pre-wrap; widows: 2; =
background-color: rgb(255, 255, 255);">Chris Angelico promises (pun =
intended) to pry further into it, and I hope you don't mind more spam =
from me in the meantime.</span></div><div><br></div><blockquote =
style=3D"margin: 0 0 0 40px; border: none; padding: 0px;"><div>mixed q =3D=
 dbconn-&gt;promise_query("select 1 from =
dual");</div><div>werror("Promise: %O\n", q);</div><div>mixed result =3D =
await(q);</div><div>werror("Result: %O\n", =
result);</div><div>werror("Rows: %O\n", =
result-&gt;get());</div><div>}</div><div><br></div><div>WARNING: =
MYSQL_OPT_RECONNECT is deprecated and will be removed in a future =
version.</div><div>Query result: ({ /* 1 element */</div><div>&nbsp; =
&nbsp; ([ /* 1 element */</div><div>&nbsp; &nbsp; &nbsp; "1": =
1</div><div>&nbsp; &nbsp; ])</div><div>})</div><div>Create future =
mysql(/*mysql-test.gotagtech.com via TCP/IP*/) "select 1 from dual" =
0</div><div>Create future result mysql(/*mysql-test.gotagtech.com via =
TCP/IP*/) "select 1 from dual" 0</div><div>Callback got ({ /* 1 element =
*/</div><div>&nbsp; &nbsp; ({ /* 1 element */</div><div>&nbsp; &nbsp; =
&nbsp; &nbsp; 1</div><div>&nbsp; &nbsp; =
})</div><div>})</div><div>Callback got 0</div><div>Future succeeded =
"select 1 from dual"</div><div>Promise: =
__builtin.Sql.Promise(no</div><div><br></div><div><span style=3D"color: =
rgb(32, 33, 36); font-family: Roboto, arial, sans-serif; font-size: =
13px; font-variant-ligatures: normal; orphans: 2; widows: 2; =
white-space: pre-wrap; background-color: rgb(255, 255, 255); =
text-decoration-thickness: initial; text-decoration-style: initial; =
text-decoration-color: initial;">Promise: __builtin.Sql.Promise(no =
future,FutureResult from query: "select 1 from dual", bindings: 0
recordcount: 1
SQL status: still running...)</span></div><div><span style=3D"color: =
rgb(32, 33, 36); font-family: Roboto, arial, sans-serif; font-size: =
13px; font-variant-ligatures: normal; orphans: 2; widows: 2; =
white-space: pre-wrap; background-color: rgb(255, 255, 255); =
text-decoration-thickness: initial; text-decoration-style: initial; =
text-decoration-color: initial;"><br></span></div></blockquote><font =
color=3D"#202124" face=3D"Roboto, arial, sans-serif" size=3D"2"><span =
style=3D"white-space: pre-wrap;">Thanks much and have a good and great =
one.</span></font><div><font color=3D"#202124" face=3D"Roboto, arial, =
sans-serif" size=3D"2"><span style=3D"white-space: =
pre-wrap;"><br></span></font></div><div><font color=3D"#202124" =
face=3D"Roboto, arial, sans-serif" size=3D"2"><span style=3D"white-space: =
pre-wrap;">Mike</span></font></div></body></html>=

--Apple-Mail=_D6831569-CCEF-4E99-BF65-150783C520A7--