1 of 1 people found this helpful
Yes it can revert all pending actions before a commit via single rollback command.
For latest version Please refer the link http://docs.rhomobile.com/en/5.0.0/api/Database#mrollbackTransaction
I wish this project was using the latest version, but alas that is not the case. The latest API definitely makes it clear that the transaction spans all work againt the DB. The older API places the transaction API at the model level instead, so this is less clear. I didn't find anything definitive in the older docos.
Tom - it takes very little effort to go from Rhodes 4.x. to 5.x. The big jump is from 3.5.x to 4.x. The old 3.5 APIs are still there, and so there is no need to re-write, for example, your network code. Use new features in new code, leave the old code if you can't get to updating it.
We went from 3.5 to 4.0 in a couple weeks, (for a suite of 6 large apps) and then from 4.x to 5.x in a day. There is very little if anything you would need to change.
Of course, if there's something broken in 5 that you need and know about, that's a different matter. I'd urge you to update, otherwise.
We wanted to take advantage of certain features, and so I re-wrote our application.rb to use new callbacks, and we re-wrote all of our network code, because we were setting timeouts globally and now can set them on each network call. Otherwise, there would have been no immediate need to re-write network code. I changed our code to use new logging, because of the better flexibility.
I suppose eventually they will pull the plug on old APIs but for now it is easy to triage and only change code where there is some direct benefit to changing it.
I took a look at some old code of mine that uses transactions, but that wasn't helpful, since that code only uses one table!
The new API does certainly make it more clear that it applies across tables.
It's not all *that* unclear int he old one, though, when you read the code:
db = ::Rho::RHO.get_src_db('Model')
So, you're getting the database object that holds some model. And then you are working with that database. The difference in 4.x is now there is a convenient global database instance that you can reference directly instead of asking a model for it. The new API is certainly a better, more clear and consistent design.