IndoTech
25th July 2016, 10:29
Hi,

I have one query regarding db.retry.point(), dal.save.object and commit.transaction() in case of multiple table updates.

If we have to update multiple tables using dal.change.object()

so to commit the whole transaction or abort whole transaction and start the transaction from all new from db.retry.point(), we need to follow the sequence as below ... Please correct if wrong..

1) db.retry.point()

2) dal.get.object(tbl1)

3) dal.change.object(tbl1)

4) dal.set.field( fld, val)

5) dal.save.object(tbl1)

then for next table - tbl2 with out db.retry.point()

6) dal.get.object(tbl2)

7) dal.change.object(tbl2)

8) dal.set.field( fld, val)

9) dal.save.object(tbl2)

10) commit.transaction() the whole transaction for tbl1 and tbl2 at last right?

Regards
Kedar

bhushanchanda
25th July 2016, 12:11
Hi,

Yes, this seems alright. This will save you from partially commited transactions and unbalanced data in both tables.

Hence, a single commit/abort at the end should work.

IndoTech
25th July 2016, 13:24
Thanks Bhuhan

One more such kind of query is what is the drawback of if we use old fashion
" select tbl1 for update" , db.update for standard tables instead of DAL functions as in previous thread "Transaction and DAL"

Please help as I need to defend/ answer to project leader, the use of DAL functions is good, instead of old fashion update.

Regards
Kedar

bhushanchanda
25th July 2016, 14:43
Hi,

There are numerous drawbacks of not using DAL (in case if the DAL exists on a standard table)

1. With db.* functions the related tables are not updated

e.g. If you use db.* functions to insert data in tdsls401 table, you need to explicitly insert data into other related tables like history tables etc

2. With db.* functions the field checks (if any) written on DAL won't be executed and with this there are chances to insert bad data into table.

e.g. If you insert the record in tdsls400 with status (hdst) as approved or closed, you won't be given any errors. But with DAL, the checks will be performed and you will be stopped during record insert.

These are quite few examples. But, I believe, wherever possible, go for DAL instead of db.* functions or AFS.

IndoTech
25th July 2016, 16:41
Thanks lot... Bhushan...

Regards
Kedar

Ajesh
26th July 2016, 11:16
With db.* functions the DAL hooks wont be called.. Whatever Business Logic you would have inserted into DAL wont get called.

srprks
26th July 2016, 11:28
DB DLL's are also there you can use that too for db.*