Page 1 of 1

Unistoredproc.applyupdates Error

Posted: Thu 13 Jun 2013 13:35
by Suhaimin
Hello,

I have a store procedure in PostgreSQL :
CREATE OR REPLACE FUNCTION "UPDATEBALANCES"(a integer, b money)
RETURNS void AS
$BODY$UPDATE "BALANCES"
SET "CODE" = $1, "BALANCE" = $2 $BODY$
LANGUAGE sql VOLATILE
COST 100;
ALTER FUNCTION "UPDATEBALANCES"(integer, money)
OWNER TO postgres;


in design time I set :
Unistoredproc.cacheupdates := true ;
unistoredproc.storedprocname :='UPDATEBALANCES';

try
uniconnection.StartTransaction;
unistoredproc.Close;
unistoredproc.ParamByName('a').VALUE := 100;
unistoredproc.ParamByName('b').VALUE := 200000;
unistoredproc.Execute;
unistoredproc.ApplyUpdates;
UniConmection.Commit;
except
unistoreproc.RestoreUpdates;
UniConmection.Rollback;
end;

after i run unistoredproc.ApplyUpdates error occurs "Can not perform this operation on closed dataset" .. why this error occur ?do i need to applyupdates unistoredproc ? pls advise.. thanks a lot..

Re: Unistoredproc.applyupdates Error

Posted: Thu 13 Jun 2013 15:04
by DemetrionQ
Hello.

The ApplyUpdates and RestoreUpdates methods are designed for situations when you work with open datasets in the CachedUpdates = True mode. Since your procedure does not return a dataset, you get an error when trying to execute ApplyUpdates and RestoreUpdates. To solve the problem, remove the calls of ApplyUpdates and RestoreUpdates from your code.

Re: Unistoredproc.applyupdates Error

Posted: Thu 13 Jun 2013 16:19
by Suhaimin
Hello,

thanks..so every time statement with uniconnection.starttransaction that mean process still in cache server ?thanks a lot

Re: Unistoredproc.applyupdates Error

Posted: Fri 14 Jun 2013 08:38
by DemetrionQ
Hello.

After execution of TUniConnection.StartTransaction, all data changes will be stored in the server cash till execution of TUniConnection.Commit or TUniConnection.Rollback.

Re: Unistoredproc.applyupdates Error

Posted: Fri 14 Jun 2013 15:10
by Suhaimin
Hello,


Thanks a lot...

Re: Unistoredproc.applyupdates Error

Posted: Fri 14 Jun 2013 17:18
by DemetrionQ
If any other questions come up, please contact us.