Use sql batch to optimize

This commit is contained in:
WQY\qiong
2023-03-16 08:30:04 +08:00
parent 1d2ac09c92
commit 04a58bb864
29 changed files with 145 additions and 105 deletions

View File

@@ -97,7 +97,7 @@ def inp_in_demand(section: list[str]) -> ChangeSet:
return cs
def inp_in_demand_new(name: str, line: str) -> None:
def inp_in_demand_new(line: str) -> str:
tokens = line.split()
num = len(tokens)
@@ -111,7 +111,7 @@ def inp_in_demand_new(name: str, line: str) -> None:
category = str(tokens[3]) if num_without_desc >= 4 else None
category = f"'{category}'" if category != None else 'null'
write(name, f"insert into demands (junction, demand, pattern, category) values ('{junction}', {demand}, {pattern}, {category});")
return f"insert into demands (junction, demand, pattern, category) values ('{junction}', {demand}, {pattern}, {category});"
def inp_out_demand(name: str) -> list[str]: