[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 1.5 , Adding conditional consistency check to acc_trans updating sql functions ?






On Mon, Feb 10, 2014 at 2:09 AM, herman vierendeels <..hidden..> wrote:
Hello everyone,

Would it be of value to have following setting_key in defaults:

check_consistency : yes|no

After running a bug-fixing setup, one could for some time set this
value to true.

My current plan (with the financial rewrite) is to have a finalize transaction function which checks the transaction's final state.  One big issue is that since we don't (yet) have an easy way of passing in really complex data into stored procedures, it makes more sense to pass it in line by line. 

Long run (probably not for 1.5 unfortunately) I would like to have types that can serialize themselves and then just use that to create a native representation.  That's a bit more work though and I don't think our tooling is there.

Every sql-function , updating acc_trans, could then check this setting_key and
if true , perform a function like: 

If we are going to do it, why not just have that function be a stand-alone function and have the code call it after post (if the setting key is set)? 

That would provide an easy way to retrofit with the old code in case the rewrite doesn't make it in.


  SELECT sum(amount) INTO balance FROM acc_trans
     WHERE trans_id = in_id
    HAVING sum(amount) <> 0;

   IF FOUND THEN
      RAISE WARNING 'Balance: %', balance;
      RAISE EXCEPTION 'Out of balance';
   END IF;


Herman

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel



--
Best Wishes,
Chris Travers

Efficito:  Hosted Accounting and ERP.  Robust and Flexible.  No vendor lock-in.
http://www.efficito.com/learn_more.shtml