Commit 01e3fbac authored by Julian Rother's avatar Julian Rother
Browse files

Add delimiter grouping support for queries

parent 1482d1ea
......@@ -64,12 +64,16 @@ def query(operation, *params, delim="sep"):
rows = cur.fetchall()
res = []
for row in rows:
res.append({})
res.append([{}])
for col, desc in zip(row, cur.description):
name = desc[0].split('.')[-1]
if type(col) == str:
if name == delim:
res[-1].append({})
elif type(col) == str:
col = col.replace('\\n', '\n').replace('\\r', '\r')
res[-1][name] = col
res[-1][-1][name] = col
if len(res[-1]) == 1:
res[-1] = res[-1][0]
return res
def modify(operation, *params):
......
Supports Markdown
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