Transaction for database query

71 Views Asked by At

I have been using Rhom to store data of the users, but while inserting the data, if you some parsing reasons the app gets some error, the the partial data get inserted into the db.

Do we have any database transaction concept fro Rhom database query ?

1

There are 1 best solutions below

0
On

Fortunately, yes rhodes do have as below,

db = ::Rho::RHO.get_src_db("Model")
db.start_transaction

begin            
    # your logic
    db.commit
rescue
    db.rollback
end