code_junkie

Storage transactions in Redland's Python bindings?

Nov 12th, 2011
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. import RDF, Redland
  2.  
  3. storage = RDF.Storage(...)
  4. model = RDF.Model(storage)
  5. Redland.librdf_model_transaction_start(model._model)
  6. try:
  7. # Do something
  8. Redland.librdf_model_transaction_commit(model._model)
  9. model.sync()
  10. except:
  11. Redland.librdf_model_transaction_rollback(model._model)
  12.  
  13. class Model(object):
  14. ...
  15. def transaction_start(self):
  16. return Redland.librdf_model_transaction_start(self._model)
Add Comment
Please, Sign In to add comment