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

@@ -41,16 +41,18 @@ def inp_in_option(section: list[str]) -> ChangeSet:
return result
def inp_in_option_new(name: str, section: list[str]) -> None:
def inp_in_option_new(section: list[str]) -> str:
sql = ''
result = inp_in_option(section)
for op in result.operations:
for key in op.keys():
if key == 'operation' or key == 'type':
continue
if op['type'] == 'option':
write(name, f"update options set value = '{op[key]}' where key = '{key}';")
sql += f"update options set value = '{op[key]}' where key = '{key}';"
else:
write(name, f"update options_v3 set value = '{op[key]}' where key = '{key}';")
sql += f"update options_v3 set value = '{op[key]}' where key = '{key}';"
return sql
def inp_out_option(name: str) -> list[str]: