N
N
Neonoviiwolf2019-07-05 00:20:58
Java
Neonoviiwolf, 2019-07-05 00:20:58

Is it possible to get all tables in Retrofit with one query?

Good. I have a database server with several tables, I need to transfer this data when connecting the application.
As a result, I receive this data from the server, but for each table I write a separate query, i.e. you have to contact the server several times, is it really worth doing this?
Or in this case, you need to create a virtual table?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
orbit070, 2019-07-05
@orbit070

It is possible and one request from the client.
When you contact the server for data, then on the server side you request data from each required table in turn, glue the result into a json like:

{
    "table1": {
        "field1": value1,
        "field2": value2,
        ...
    },
    "table2": {
        "field1": value1,
        "field2": value2,
        ...
    },
    ...
}

and return to the client.
On the client, respectively, create a class that will match your json to easily parse the response.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question