Unistoredproc.applyupdates Error

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

Unistoredproc.applyupdates Error

Post by Suhaimin » Thu 13 Jun 2013 13:35

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..

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

Re: Unistoredproc.applyupdates Error

Post by DemetrionQ » Thu 13 Jun 2013 15:04

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.

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

Re: Unistoredproc.applyupdates Error

Post by Suhaimin » Thu 13 Jun 2013 16:19

Hello,

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

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

Re: Unistoredproc.applyupdates Error

Post by DemetrionQ » Fri 14 Jun 2013 08:38

Hello.

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

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

Re: Unistoredproc.applyupdates Error

Post by Suhaimin » Fri 14 Jun 2013 15:10

Hello,


Thanks a lot...

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

Re: Unistoredproc.applyupdates Error

Post by DemetrionQ » Fri 14 Jun 2013 17:18

If any other questions come up, please contact us.

Post Reply