Page 1 of 1

TUniquery vs TUnistoreproc

Posted: Mon 10 Jun 2013 09:09
by Suhaimin
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

Re: TUniquery vs TUnistoreproc

Posted: Tue 11 Jun 2013 15:31
by DemetrionQ
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.

Re: TUniquery vs TUnistoreproc

Posted: Tue 11 Jun 2013 23:47
by Suhaimin
Thanks a lot

Re: TUniquery vs TUnistoreproc

Posted: Wed 12 Jun 2013 11:28
by DemetrionQ
If any other questions come up, please contact us.