TUniquery vs TUnistoreproc

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Suhaimin
Posts: 79
Joined: Mon 06 May 2013 12:19

TUniquery vs TUnistoreproc

Post by Suhaimin » Mon 10 Jun 2013 09:09

hello,

I have a store procedure at postgresql
CREATE OR REPLACE FUNCTION "GETINVOICENO"
RETURNS SETOF AS
'Select "INVOICENO" from "sales"
LANGUAGE sql VOLATILE
COST 100
ALTER FUNCTION "GETINVOICENO"
OWNER TO postgres;

unistoreproc.close;
unistoreproc.open;


uniquery.close;
uniquery.sql.clear;
uniquery.sql.add('select invoiceno from sales');
uniquery.open;

which one is more effective and speed to use it, unistoreproc or uniquery to get all invoiceno?
thanks a lot

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: TUniquery vs TUnistoreproc

Post by DemetrionQ » Tue 11 Jun 2013 15:31

Hello.

    You can find answers to your questions concerning execution speed of stored procedures and SELECT queries on a PostgreSQL server in the PostgreSQL documentation.

    TUniStoredProc and TUniQuery have the same performance when working with results returned by a stored procedure and a SELECT query.

    TUniStoredProc doesn't allow edit a received dataset by default, in contrast to TUniQuery (that allows editing a dataset returned by a SELECT query). To edit the returned dataset via TUniStoreProc in the same way as via TUniQuery, you should set the TUniStoredProc.Options.SetFieldsReadOnly property to False and correctly set the TUniStoredProc.SQLUpdate and similar properties (SQLInsert, SQLDelete, SQLLock, SQLRefresh). The information about the named TUniStoredProc component properties can be found in the UniDAC documentation.
Last edited by DemetrionQ on Wed 12 Jun 2013 09:14, edited 2 times in total.

Suhaimin
Posts: 79
Joined: Mon 06 May 2013 12:19

Re: TUniquery vs TUnistoreproc

Post by Suhaimin » Tue 11 Jun 2013 23:47

Thanks a lot

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: TUniquery vs TUnistoreproc

Post by DemetrionQ » Wed 12 Jun 2013 11:28

If any other questions come up, please contact us.

Post Reply