poggit / libasynql

Asynchronous MySQL access library for PocketMine plugins.
https://poggit.github.io/libasynql
Apache License 2.0
134 stars 45 forks source link

Cannot insert UUID into database #11

Closed ghost closed 5 years ago

ghost commented 5 years ago

Describe the bug I tried inserting my uuid into my database but it failed. I got this error:

[16:55:49] [Server thread/CRITICAL]: RuntimeException: "Unsupported variable type" (EXCEPTION) in "C:/Users/levi/Documents/pocketmine/virions/libasynql_dev-97.phar/src/poggit/libasynql/generic/MysqlStateme ntImpl" at line 106 code: -- # {create -- # {players -- # :uuid UUID INSERT INTO players(UUID, first_joined) VALUES(:uuid, CURRENT_TIMESTAMP ); -- # } -- # } -- # } and when i change UUID into string it gives me the following error.

SQL PREPARE error: Cannot bind value of type object, for query INSERT INTO players Expected behavior No error. Able to insert uuid into database Environment OS: Windows 10 PocketMine version: PocketMine-MP 3.6.2 for Minecraft: Bedrock Edition v1.9.0 (protocol version 332)

dries-c commented 5 years ago

UUID isn't a database supported thing as far as I know....

ghost commented 5 years ago

Why not

ghost commented 5 years ago

Is it better to use name for fetching

SOF3 commented 5 years ago

Either use $uuid->toString() or $uuid->toBinary(). The raw UUID object is not a value understood by MySQL. The data type in the .sql declaration is supposed to be a scalar data type, not a specific MySQL data type .