## 1.4.8 Transactions, Rollbacks and Committing Changes

Most databases supported by `web.database` support basic transactions. This means that you can make a number of changes to the database but if your program crashes your changes will not be saved so that the database is not left in an unstable state where you have updated some tables but not others.

Changes are only saved (or committed) to the database when you call the `connection` object's `commit()` method:

    connection.commit()

If you have made a mistake and want to lose all the changes you have made, you can rollback the database to its previous state using the `connection` object's `rollback()` method:

    connection.rollback()

Finally, if you have finished using a connection you can close it using the `connection` object's `close()` method. This will also rollback the database to the time you last committed your changes so if you want to save your changes you should call `commit()` first.

    connection.commit()
    connection.close()

Note: Please note that making these changes to the `connection` object will automatically affect all `cursor` objects of that connection as well since they all share the same connection object.

Warning: The MySQL adapter does not support transactions. Results are automatically committed. If anyone can suggest an effective way around this please let me know!