Closed ghost closed 3 years ago
What database type are you using?
Please provide a full error if possible.
I am using MySQL (self hosted, MariaDB).
The 'create table' query works fine.
Could you try to modify this and show the value of $variable->getType()? https://github.com/poggit/libasynql/blob/0192bcd58db0ef25160ec49f309eb2417e4726ac/libasynql/src/poggit/libasynql/generic/MysqlStatementImpl.php#L69
'string' is echoed when I do:
echo $variable->getType();
That'd be strange. This line is supposed to handle that case.
Can you var_dump()
it and check if it is really string(6) "string"
?
https://github.com/poggit/libasynql/blob/0192bcd58db0ef25160ec49f309eb2417e4726ac/libasynql/src/poggit/libasynql/generic/MysqlStatementImpl.php#L85
I can confirm that it returns string(6) "string".
I was playing around with things and fixed the issue. However, it is passing NULL to the table instead of the strings. Not sure if this is on my end or the virions. (Most likely mine).
It is an issue with the virion.
$this->database->executeInsert("manage.register", ["player" => "Dapro5173", "setting" => "formui"]);
-- # { register
-- # :player string
-- # :setting string
INSERT INTO player_form_settings
VALUES
(
username = :player,
setting = :setting
);
This doesn't make sense just by reading the code. Could you try to debug why the switch-case with string
doesn't return?
Try
INSERT INTO `player_form_settings` (`username`, `setting`) VALUES (:player,
:setting);
On Sat, Mar 20, 2021, 11:18 Chan Kwan Yin @.***> wrote:
This doesn't make sense just by reading the code. Could you try to debug why the switch-case with string doesn't return?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/poggit/libasynql/issues/51#issuecomment-803235396, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHQQFBE6GPBBVWE2BMWDGDTEQHXLANCNFSM4ZNSSCWA .
that shouldn't affect this bug
It might be that the \pocketmine\Player import is missing or has a typo in it.
Btw, shouldn't it be VALUES(:player, :setting)
rather than VALUES(username = :player, setting = :setting)
?
yes it should be, but that shouldn't cause the crash above.
The import is correct. I've tried using: VALUES(:player, :setting)
and it worked. The unsupported variable error no longer shows, so I assume I fixed it without realizing it. Thank you for all your help!
how could that be even relevant...
Description: I am executing a 'Insert' query with 2 string variables. Valid variable types are being passed to those variables, but I am getting a "Unsupported variable type" exception.
Sample code
Expected behavior A row is inserted into the table: username -> Dapro5173, setting -> formui
Environment OS: Windows 10 PocketMine version: 3.18.0