From: burris <burris>
Date: Thu, 28 Nov 2002 01:15:58 +0000 (+0000)
Subject: use autocommit
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cd5409cb833e3b7d5f8d0f89d845c08b7d30ec39;p=quix0rs-apt-p2p.git

use autocommit
---

diff --git a/actions.py b/actions.py
index 054f886..1c58ee0 100644
--- a/actions.py
+++ b/actions.py
@@ -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
diff --git a/khashmir.py b/khashmir.py
index 4831913..36ff79f 100644
--- a/khashmir.py
+++ b/khashmir.py
@@ -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)