Commit 8dae48ef authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

Fix trasactionless query in pithos sqlite backend init

Refs: #3580
parent 1f0f815b
......@@ -37,8 +37,10 @@ class DBWorker(object):
def __init__(self, **params):
self.params = params
conn = params['wrapper'].conn
cur = params['wrapper'].conn.cursor()
wrapper = params['wrapper']
self.wrapper = wrapper
conn = wrapper.conn
cur = wrapper.conn.cursor()
self.execute = cur.execute
self.executemany = cur.executemany
self.fetchone = cur.fetchone
......
......@@ -181,8 +181,13 @@ class Node(DBWorker):
on update cascade
on delete cascade ) """)
q = "insert or ignore into nodes(node, parent) values (?, ?)"
execute(q, (ROOTNODE, ROOTNODE))
wrapper = self.wrapper
wrapper.execute()
try:
q = "insert or ignore into nodes(node, parent) values (?, ?)"
execute(q, (ROOTNODE, ROOTNODE))
finally:
wrapper.commit()
def node_create(self, parent, path):
"""Create a new node from the given properties.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment