One or more consultations
If you have a specific goal of performing a query to obtain certain information organized in a certain way, yes, the most effective way is a single query to the database that returns everything already ready to use:
Consultation
Assuming you intend to consult regarding suspeito
X:
SELECT
tp_artigo.descricao_artigo AS descricao_artigo,
processo_judicial.dt_processo AS dt_processo,
tp_situacao_processo.descricao_situacao_processo AS descricao_situacao,
processo_judicial.pdf_processo AS pdf_processo
FROM suspeito
INNER JOIN suspeito_processo ON (
suspeito_processo.cd_suspeito = suspeito.cd_suspeito
)
INNER JOIN processo_judicial ON (
processo_judicial.num_processo = suspeito_processo.num_processo
)
INNER JOIN tp_situacao_processo ON (
tp_situacao_processo.cd_situacao_processo = processo_judicial.cd_situacao_processo
)
INNER JOIN tp_artigo ON (
tp_artigo.cd_artigo = processo_judicial.cd_artigo
)
WHERE suspeito.cd_suspeito = 1
Outcome of the consultation
The above query performs a specific task which is the collection of the following data concerning the suspeito
X:
┌──────────────────┬─────────────┬────────────────────┬──────────────┐
│ descricao_artigo │ dt_processo │ descricao_situacao │ pdf_processo │
└──────────────────┴─────────────┴────────────────────┴──────────────┘
Web service or Mysql View
Whether the query is for general information, ie for all suspeito
, one VIEW
is preferable because it becomes more practical to update in the future and also because there are no variable data to consider.
If the consultation is as I understood it, consult certain information from the suspeito
X, then the web service will be the way forward because of the logic and validations to do to the data.
Note: You may have a VIEW
also receiving parameters, but for that you need to create a Mysql function. Too much work and code to maintain, where it is also preferable to keep the consultation in the web service.
Use SELECT if you want to leave the query in the application layer (backend) and use VIEW if you want to leave the query in the database layer. If you want help with the query or view, please post the code you have tried so far.
– Caffé
My question is this request inside a SOAP envelope, a result of a suspect with more than one lawsuit?
– Luiz Gustavo Lima
I was looking for the best way to form the SOAP envelope.
– Luiz Gustavo Lima