Update curve sql

This commit is contained in:
WQY\qiong
2022-11-04 22:49:41 +08:00
parent 36f5112f32
commit 0e45c8e825

View File

@@ -75,7 +75,7 @@ def add_curve_cache(name: str, cs: ChangeSet) -> SqlChangeSet:
new_f_type = f"'{new['c_type']}'" new_f_type = f"'{new['c_type']}'"
# TODO: transaction ? # TODO: transaction ?
redo_sql = f"\ninsert into _curve (id, type) values ({f_id}, {new_f_type});" redo_sql = f"insert into _curve (id, type) values ({f_id}, {new_f_type});"
for xy in cs.operations[0]['coords']: for xy in cs.operations[0]['coords']:
x, y = float(xy['x']), float(xy['y']) x, y = float(xy['x']), float(xy['y'])
f_x, f_y = x, y f_x, f_y = x, y
@@ -106,7 +106,7 @@ def delete_curve_cache(name: str, cs: ChangeSet) -> SqlChangeSet:
redo_sql += f"\ndelete from _curve where id = {f_id};" redo_sql += f"\ndelete from _curve where id = {f_id};"
# TODO: transaction ? # TODO: transaction ?
undo_sql = f"\ninsert into _curve (id, type) values ({f_id}, {old_f_type});" undo_sql = f"insert into _curve (id, type) values ({f_id}, {old_f_type});"
for xy in old['coords']: for xy in old['coords']:
f_x, f_y = xy['x'], xy['y'] f_x, f_y = xy['x'], xy['y']
undo_sql += f"\ninsert into curves (id, x, y) values ({f_id}, {f_x}, {f_y});" undo_sql += f"\ninsert into curves (id, x, y) values ({f_id}, {f_x}, {f_y});"