Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Godot 4.0 Alpha #57

Open
Spiralexe opened this issue Mar 19, 2023 · 4 comments
Open

Godot 4.0 Alpha #57

Spiralexe opened this issue Mar 19, 2023 · 4 comments
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed question Further information is requested

Comments

@Spiralexe
Copy link

So in 3.0's database.execute would return an array of the data you requested however in 4.0 it returns only an integer, how are we supposed to get the data in 4.0 alpha?

@Marzin-bot
Copy link
Owner

Hello, the entity returned with the "execute" method in the godot4 version is actually an enumeration, the execution error number. To get the result of a request you must wait for a "data_received" signal to be emitted. It carries with it the result of the request.

@Marzin-bot
Copy link
Owner

The postgre client documentation has changed since version 4 of godot. A signal is emitted (request processing time by the backend). This is to prevent the request from blocking the Godot process. An example in the Helloworld.gd file is provided for this version (alpha branch).

@Marzin-bot Marzin-bot added documentation Improvements or additions to documentation help wanted Extra attention is needed question Further information is requested labels Mar 19, 2023
@Spiralexe
Copy link
Author

seems very counter intuitive and not simple to use

@Marzin-bot
Copy link
Owner

Marzin-bot commented Mar 19, 2023

However, this is necessary because the backend takes some time to execute the query before sending the result to the fontend. On the godot3 version the process hangs during this time which leads to friezes of games or game servers. On godot 4 I removed this constraint to avoid this problem. Once you send a request to the backend, you have to wait for a response. This results in waiting for the "data_received" signal to be emitted. Waiting for the result of the query is an unavoidable constraint in client/server applications. A solution to make good use of the client is to send a request to the server, wait for a response from the server and only then execute the next request. you can create a waiting list of Postgres requests to be made if you have a lot of requests to make. when you get a response to a request, you remove that request from the waitlist and move on to the next request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants