added DataStore.getTaskByNameParent()
This commit is contained in:
parent
bcac83a5a9
commit
d1a81c2a9c
21
DataStore.py
21
DataStore.py
@ -99,6 +99,27 @@ WHERE id = ?
|
|||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
def getTaskByNameParent(self, name, parentid):
|
||||||
|
t = None
|
||||||
|
c = self.conn.cursor()
|
||||||
|
if parentid is None:
|
||||||
|
c.execute('''
|
||||||
|
SELECT id, name, longname, parentid
|
||||||
|
FROM tasks
|
||||||
|
WHERE name = ? AND parentid IS NULL
|
||||||
|
''', (name,))
|
||||||
|
else:
|
||||||
|
c.execute('''
|
||||||
|
SELECT id, name, longname, parentid
|
||||||
|
FROM tasks
|
||||||
|
WHERE name = ? AND parentid = ?
|
||||||
|
''', (name, parentid))
|
||||||
|
for row in c:
|
||||||
|
t = Task(*row)
|
||||||
|
c.close()
|
||||||
|
self.conn.commit()
|
||||||
|
return t
|
||||||
|
|
||||||
def createTask(self, name, longname, parentid):
|
def createTask(self, name, longname, parentid):
|
||||||
c = self.conn.cursor()
|
c = self.conn.cursor()
|
||||||
if parentid is not None and parentid != '':
|
if parentid is not None and parentid != '':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user