Database applications and OOness

  1. Regarding transactions: I haven’t done this, but I don’t imagine it
    would be difficult. A Ruby-like style for it might be something like:

objectStore.runTransaction {
account1743.balance -= 100
account1743.commit
account329.balance += 100
account329.commit
}

DBI supports this. Given a database handle db, you can do …

db.transaction do
db.do(“UPDATE accounts SET balance = balance - 100 WHERE accnum = 1743”)
db.do(“UPDATE accounts SET balance = balance + 100 WHERE accnum = 329”)
end

Make sure that auto-commit mode is OFF before using the transaction method.

···

–
– Jim Weirich / Compuware
– FWP Capture Services
– Phone: 859-386-8855