Helma logo
helma.org » Home > Stories > res.commit()

res.commit()

Commits the current transaction, writing all changed objects to the database, and starts a new transaction.

Syntax
res.commit()

Usually, Helma automatically wraps each request into a database transaction. Use res.commit() if you have to modify a huge ammount of HopObjects within one request and want to partition the transaction into several smaller ones.

Example

for (var i in collection1)
    collection1.get(i).counter += 1;
// commit changes to elements of collection1 to db
res.commit();
for (var i in collection2)
    collection2.get(i).counter -= 1;
// changes to elements of collection2 are committed 
// automatically when the request terminates


... comment


Page last modified on 2005-02-01 14:38 by hns