Commit 6a6047c0 authored by Julian Rother's avatar Julian Rother
Browse files

Change delimiter mechanism to sub-dict scheme

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