qgis/QGIS — pull request #1367 by mhugent (2014-05-18 15:48:57+00:00)
Title: Transation support for layer groups

This pull request adds a transaction mode to a group of layers. Within these layers, edits are bypassing the QGIS edit buffer and are directly written into a database transaction. The edits are visible for layers outside the group or for external tools once the transaction is commited.

Background is that for complex application modules, a large number of database tables exist with a lot of foreign key dependencies, rules, triggers, etc. In such complex systems, it is necessary to see the effect of an edit immediately (e.g. foreign key violation, change in another table by a trigger), while a set of changes can still be rollbacked / commited together using the db transaction. There is now also the possibility to call sql commands through the QgsTransaction class (important e.g. for functions that create objects with all foreign key dependencies in application modules).
Now it could be argued that a transaction should be made directly from an (application module) plugin to the database and not go via the dataprovider. But then, the nice builtin QGIS edit tools and relations could not be used. Furthermore, the changes committed to the transaction would not even be visible to QGIS until the plugin transaction is committed.

The pull request has several parts:
- Class QgsTransaction with python interface
- Bypassing the edit buffer in vector layer edit methods ( QgsVectorLayer::changeAttributeValue etc. )
- Support in Postgres Provider (QGISEXTERN methods)
- The possibility to request the transaction connection in QgsConnectionPool::acquire / release for rendering

@jef-n, @wonder-sk : are you available to review these changes? You know the db classes / connection pool better than I do, so I'm sure you have some good inputs and suggestions.