bizen99
1st July 2003, 10:58
Hi,

I want to make a commit that only affect a part of the open updates. Example:

select t1.*
from t1 for update
selectdo
t1.date = 0
db.update(tt1,db.retry)
select t2.*
from t2 for update
selectdo
t2.date = 0
db.update(tt2,db.retry)
commit.transaction() ---> only for t2 ?
endselect
endselect

Is this posible?

thanks

Leenaa
1st July 2003, 11:30
hi bizen !

why don't u end ur first selection before selecting the next one means write endselect before selecting the next table t2.

bizen99
1st July 2003, 11:44
because is a little complicated,


select t1.*
from t1 for update
selectdo
t1.date = 0
db.update(tt1,db.retry)
select t2.*
from t2 for update
selectdo
t2.date = 0
db.update(tt2,db.retry)
commit.transaction() ---> only for t2 ?
endselect
if ? then
abort.transaction() ----> I forgot this line
else
commit.transaction()
endif
endselect


I don't want that 'abort.transaccion' affect the first commit

bizen99
1st July 2003, 11:45
How can I put 'TABS' in sentences?

NvanBeest
1st July 2003, 11:47
Is this posible?

Nope. Baan does not cater for nested transactions. Leena's suggestion is the best in this situation. From the query you posted, it doesn't look like there is a link between the tables. If there is, then you could try the following route:


db.retry.point()
select t1.*
from t1
selectdo
select t2.*
from t2 for update
where t2.xxx = :t1.xxxx
selectdo
...
db.update(t2, db.retry)
endselect
endselect
commit.transaction()

db.retry.point()
select t1.*
from t1 for update
selectdo
...
db.update(t1, db.retry)
endselect
commit.transaction()

bizen99
1st July 2003, 12:02
Hi,

I'll try to put the t2 update in a new session, and then make a zoom.to

lli-baan
2nd July 2003, 15:26
Maybe this is possible for your problem:

select t1.*
from t1 for update
selectdo
t1.date = 0

select t2.*
from t2 for update
selectdo
t2.date = 0
db.update(tt2,db.retry)
commit.transaction()
endselect

db.update(tt1,db.retry)

if ? then
abort.transaction()
else
commit.transaction()
endif
endselect