In MariaDB, a MySQL alternative, there is a RETURNING statement in INSERT statements. (I find it safer and simpler than INSERT+SELECT)
I am using DataConnector::asyncSelect() to receive this response. However, if the query fails due to an error, the MysqliThread fainted without proccessing the generator...
This makes it impossible for the code to determine the success or progress of the operation.
Before PR:
(MysqliThread goes down and after that, the correct query request doesn't work either.)
After PR:
(The error is throw correctly, and now can catch it to process it.)
Tested test.sql code
-- #! mysql
-- # { test1
CREATE TABLE IF NOT EXISTS test
(
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
value INT UNSIGNED NOT NULL
);
-- # }
-- # { test2
INSERT INTO test (value)
VALUES (-9999)
RETURNING id, value;
-- # }
Tested php code
$conn = libasynql::create($this, $this->getConfig(), ["mysql" => "test.sql"]);
Await::f2c(static function() use ($conn){
yield from $conn->asyncGeneric("test1");
var_dump(yield from $conn->asyncSelect("test2"));
});
In MariaDB, a MySQL alternative, there is a RETURNING statement in INSERT statements. (I find it safer and simpler than INSERT+SELECT)
I am using
DataConnector::asyncSelect()
to receive this response. However, if the query fails due to an error, the MysqliThread fainted without proccessing the generator... This makes it impossible for the code to determine the success or progress of the operation.Before PR:
(MysqliThread goes down and after that, the correct query request doesn't work either.)
After PR:
(The error is throw correctly, and now can catch it to process it.)
Tested
test.sql
codeTested php code