PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV Mobile 2024 → [WM23] HExecuteProcedure
[WM23] HExecuteProcedure
Iniciado por ARV, jul., 12 2018 6:35 PM - 8 respostas
Membro registado
498 mensagems
Popularité : +8 (8 votes)
Publicado em julho, 12 2018 - 6:35 PM
Hi

I was wondering about to execute a stored Procedure but this are going to return a Data Source, when I try to read this data source WM said that this data source wasn't declare.

In the end I conclude that the data it's delete it when it's return to the app.

So there's a way to return a data source and can be use it on my app?

Here's some code

My app:
dsTest is Data Source
dsTest = HExecuteProcedure(Connection1,ServerTest)
HReadFirst(dsTest)
Info(dsTest.ID)


My server:
HExecuteQuery(QRY_QueryTestProcedure)
RESULT QRY_QueryTestProcedure


or

resp is Data Source
HExecuteSQLQuery(resp,hQueryWithoutHFCorrection,"Select * From Table_Test")
RESULT resp


Thanks.

--
Best Regards
Jose
Membro registado
498 mensagems
Popularité : +8 (8 votes)
Publicado em julho, 13 2018 - 9:52 PM
Hi

Let me re-write the question.

I know that the procedure return a variant, but If I execute a query and I have a total of 10 data, is it possible to send the 10 of them to my app?

Like using a for each of my query and then using a Result on my procedure to my app. is it possible?

--
Best Regards
Jose
Publicado em julho, 16 2018 - 2:27 PM
Hi Jose

there is something I don't understand.

You expect a result, which means that you will be waiting for the end of
the procedure execution to get it...

Why use a stored procedure to do that? What could possibly be the advantage?

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Free Video Courses, free WXShowroom.com, open source WXReplication, open
source WXEDM.

More information on http://www.fabriceharari.com




n 7/13/2018 1:52 PM, Jose wrote:
Hi

Let me re-write the question.

I know that the procedure return a variant, but If I execute a query and
I have a total of 10 data, is it possible to send the 10 of them to my app?

Like using a for each of my query and then using a Result on my
procedure to my app. is it possible?

--
Best Regards
Jose
Membro registado
498 mensagems
Popularité : +8 (8 votes)
Publicado em julho, 16 2018 - 3:36 PM
Hi Fabrice Harari

I only want to do this because I want to execute querys on my server and not on my device, just like not to force the device to go on my server get the info with my query and then use a for each on them, just read the data source of my server

the end of this story is that I guess I can't do that, the only thing I can get it's to save everything on a table temp from my procedure of my server and then use a query select to read all of the data I want, from my device to my server.

Thanks for your reply Fabrice Harari.

--
Best Regards
Jose
Publicado em julho, 16 2018 - 4:08 PM
Hi Jose,

I only want to do this because I want to execute querys on my server and
not on my device, just like not to force the device to go on my server


Your query is ALWAYS executed on the server... that's why it's a Client
Server DB.

The call to run the query is sent from the client or the server, but the
execution is ALWAYS done by the DB engine on the server.

So you are doing all that for a completely incorrect reason.

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Free Video Courses, free WXShowroom.com, open source WXReplication, open
source WXEDM.

More information on http://www.fabriceharari.com


get the info with my query  and then use a for each on them, just read
the data source of my server

the end of this story is that I guess I can't do that, the only thing I
can get it's to save everything on a table temp from my procedure of my
server and then use a query select to read all of the data I want, from
my device to my server.

Thanks for your reply Fabrice Harari.

--
Best Regards
Jose
Membro registado
498 mensagems
Popularité : +8 (8 votes)
Publicado em julho, 16 2018 - 5:40 PM
Hi Fabrice Harari

I tought that the device call and execute the query then the query search everything on the server,
the device with a loop or for each the query it will be fill the data on my window.

so I was thinking that if I put the query on the server itself and then use a stored procedure of the server maybe all of that will be only the server, the part of the HexecureQuery and everything else.

--
Best Regards
Jose
Publicado em julho, 16 2018 - 8:44 PM
Nope

the only difference is that the call is made from somewhere else.

You STILL will have the query executed on the server
You STILL will have the data sent back to the client
You STILL will have the data processed/displayed by the client

That is NOT what stored procedures are for.

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Free Video Courses, free WXShowroom.com, open source WXReplication, open
source WXEDM.

More information on http://www.fabriceharari.com


On 7/16/2018 9:40 AM, Jose wrote:
Hi Fabrice Harari

I tought that the device call and execute the query then the query
search everything on the server,
the device with a loop or for each the query it will be fill the data on
my window.

so I was thinking that if I put the query on the server itself and then
use a stored procedure of the server maybe all of that will be only the
server, the part of the HexecureQuery and everything else.

--
Best Regards
Jose
Membro registado
498 mensagems
Popularité : +8 (8 votes)
Publicado em julho, 17 2018 - 3:20 PM
Hi

Thanks for the reply.

So then what are they are for?

Just in case I create the stored procedures on my analysis and then pass it on my server and with Control center I see it on the store procedures of my DB.

--
Best Regards
Jose
Publicado em julho, 17 2018 - 7:36 PM
Hi,

So then what are they are for?


Many things... By example:
- DB Maintenance
- Statistics calculations
- Backup/Data Transfer
- Printing and sending via email 30000 invoices...

Basically anything where you don't need a return on the client side or
don't want to wait for a long result (you'll come back later to read it)

Of course, this can be done on demand by code in your program, OR
automatically via an automated task

Now remember one thing: stored procedures are DB dependent, and that
means that if you use them, you are stuck with the DB you coded them for
(HFCS if coded in wlanguage)... So if you want to be able to switch to
postgres or any other DB at some point in the future, you'll stay away
from this kind of technique.

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Free Video Courses, free WXShowroom.com, open source WXReplication, open
source WXEDM.

More information on http://www.fabriceharari.com

Just in case I create the stored procedures on my analysis and then pass
it on my server and with Control center I see it on the store procedures
of my DB.

--
Best Regards
Jose