svn commit: samba r25650 - in branches/4.0-python: . source/lib/ldb/swig source/lib/ldb/tests/python

jelmer at samba.org jelmer at samba.org
Mon Oct 15 13:29:03 GMT 2007


Author: jelmer
Date: 2007-10-15 13:29:02 +0000 (Mon, 15 Oct 2007)
New Revision: 25650

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25650

Log:
Add transaction functions.
Modified:
   branches/4.0-python/
   branches/4.0-python/source/lib/ldb/swig/ldb.i
   branches/4.0-python/source/lib/ldb/tests/python/api.py


Changeset:

Property changes on: branches/4.0-python
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/4.0-python/source/lib/ldb/swig/ldb.i
===================================================================
--- branches/4.0-python/source/lib/ldb/swig/ldb.i	2007-10-15 13:29:00 UTC (rev 25649)
+++ branches/4.0-python/source/lib/ldb/swig/ldb.i	2007-10-15 13:29:02 UTC (rev 25650)
@@ -45,6 +45,7 @@
 typedef struct ldb_message ldb_msg;
 typedef struct ldb_context ldb;
 typedef struct ldb_dn ldb_dn;
+typedef struct ldb_ldif ldb_ldif;
 typedef int ldb_error;
 
 %}
@@ -296,9 +297,15 @@
         ldb_dn *get_root_basedn();
         ldb_dn *get_schema_basedn();
         ldb_dn *get_default_basedn();
+
+        ldb_error transaction_start();
+        ldb_error transaction_commit();
+        ldb_error transaction_cancel();
     }
 } ldb;
 
 %nodefault ldb_message;
 %nodefault Ldb;
 %nodefault Dn;
+
+

Modified: branches/4.0-python/source/lib/ldb/tests/python/api.py
===================================================================
--- branches/4.0-python/source/lib/ldb/tests/python/api.py	2007-10-15 13:29:00 UTC (rev 25649)
+++ branches/4.0-python/source/lib/ldb/tests/python/api.py	2007-10-15 13:29:02 UTC (rev 25650)
@@ -69,6 +69,23 @@
         self.assertEquals(len(l.search()), 2)
         l.delete(ldb.Dn(l, "dc=bar"))
 
+    def test_transaction_commit(self):
+        l = ldb.Ldb("foo.tdb")
+        l.transaction_start()
+        m = ldb.Message(ldb.Dn(l, "dc=foo"))
+        m["foo"] = set(["bar"])
+        l.add(m)
+        l.transaction_commit()
+        l.delete(m.dn)
+
+    def test_transaction_cancel(self):
+        l = ldb.Ldb("foo.tdb")
+        l.transaction_start()
+        m = ldb.Message(ldb.Dn(l, "dc=foo"))
+        m["foo"] = set(["bar"])
+        l.add(m)
+        l.transaction_cancel()
+
 class DnTests(unittest.TestCase):
     def setUp(self):
         self.ldb = ldb.Ldb("foo.tdb")



More information about the samba-cvs mailing list