Push database to server by code #3537
-
I am currently working on a game using the Godot engine with a plugin called "GodotSQLite". it is a TCG and i was trying to make it possible for players to trade cards online. In order to do this they should all be able to read and write on the same database at the same time. Im using DBHub.io for this, and it worked, but, i can only submit changes to the database using the "Push currently opened database to server" button on the DB Browser. I was wondering if there was a way to do this using a query or some kind of command, so i can update the database from the game itself TLDR: is there a way to push the currently opened database to server using a query or command from an external app? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 36 replies
-
DBHub.io has its own API: https://api.dbhub.io/ Nevertheless, I am not sure if this is the correct approach in your case and probably would recommend writing your own web API to talk to a database on your own machine. |
Beta Was this translation helpful? Give feedback.
-
@SanmiCace Hmmm, are you seeing errors on your end when trying to retrieve the table list for your databases? I'm seeing what looks like an error message being spat out on the back end, which looks like something caused by a uppercase vs lowercase issue (a problem on our end, not yours). But I'm not sure if that error is making its way to you or not. ? |
Beta Was this translation helpful? Give feedback.
Oh, in your
$HTTPRequest.request()
call, is there a way to convertbody
to a string directly rather than useto_json()
?Looking at the Godot 3.x docs, it looks like there's a function called
get_string_from_utf8()
which might be what's needed instead:https://docs.godotengine.org/en/3.0/classes/class_poolbytearray.html#class-poolbytearray-get-string-from-utf8
So, that'd make it something like this: