]> git.mxchange.org Git - quix0rs-apt-p2p.git/commitdiff
use autocommit
authorburris <burris>
Thu, 28 Nov 2002 01:15:58 +0000 (01:15 +0000)
committerburris <burris>
Thu, 28 Nov 2002 01:15:58 +0000 (01:15 +0000)
actions.py
khashmir.py

index 054f886e2b9a4726c150eaa0b7c0dd20b10de565..1c58ee0785fcc0cd90b165307893894abcce0018 100644 (file)
@@ -158,7 +158,7 @@ class GetValue(FindNode):
            ## all done, didn't find it!!
            self.finished=1
            reactor.callFromThread(self.callback,[])
-    
+
     ## get value
     def goWithNodes(self, nodes, found=None):
        self.results = {}
@@ -188,6 +188,5 @@ class KeyExpirer:
        c = self.store.cursor()
        s = "delete from kv where time < '%s';" % self.cut
        c.execute(s)
-       self.store.commit()
        reactor.callLater(const.KE_DELAY, self.doExpire)
        
\ No newline at end of file
index 48319132b6a848b38fe5407164119b21e37c78dd..36ff79f8abf02894802285f8c980af4464f8c373 100644 (file)
@@ -49,12 +49,14 @@ class Khashmir(xmlrpc.XMLRPC):
     def loadDB(self, db):
        try:
            self.store = sqlite.connect(db=db)
+            self.store.autocommit = 1
        except:
            import traceback
            raise KhashmirDBExcept, "Couldn't open DB", traceback.exc_traceback
            
     def createNewDB(self, db):
        self.store = sqlite.connect(db=db)
+        self.store.autocommit = 1
        s = """
            create table kv (key text, value text, time timestamp, primary key (key, value));
            create index kv_key on kv(key);
@@ -64,7 +66,6 @@ class Khashmir(xmlrpc.XMLRPC):
            """
        c = self.store.cursor()
        c.execute(s)
-       self.store.commit()
                
     def render(self, request):
        """
@@ -265,7 +266,6 @@ class Khashmir(xmlrpc.XMLRPC):
            # update last insert time
            s = "update kv set time = '%s' where key = '%s' and value = '%s';" % (t, key, value)
            c.execute(s)
-       self.store.commit()
        ip = self.crequest.getClientIP()
        sender['host'] = ip
        n = Node().initWithDict(sender)