Return empty change set

This commit is contained in:
wqy
2022-09-17 18:31:00 +08:00
parent a72115e15f
commit b52515b26f
8 changed files with 47 additions and 50 deletions

View File

@@ -96,7 +96,7 @@ def get_patterns(name: str) -> list[str]:
def add_node(name: str, node_type: str, id: str, x: float, y: float, table_sql: str, table_undo_sql: str) -> ChangeSet:
if is_node(name, id):
return
return ChangeSet()
with conn[name].cursor() as cur:
sql = f"insert into _node (id, type) values ('{id}', '{node_type}'); "
@@ -117,7 +117,7 @@ def add_node(name: str, node_type: str, id: str, x: float, y: float, table_sql:
def delete_node(name: str, node_type: str, id: str, table_sql: str, table_undo_sql: str) -> ChangeSet:
if not is_node(name, id):
return
return ChangeSet()
with conn[name].cursor(row_factory=dict_row) as cur:
cur.execute(f"select * from coordinates where node = '{id}'")
@@ -145,7 +145,7 @@ def delete_node(name: str, node_type: str, id: str, table_sql: str, table_undo_s
def add_link(name: str, link_type: str, id: str, table_sql: str, table_undo_sql: str) -> ChangeSet:
if is_link(name, id):
return
return ChangeSet()
with conn[name].cursor() as cur:
sql = f"insert into _link (id, type) values ('{id}', '{link_type}'); "
@@ -164,7 +164,7 @@ def add_link(name: str, link_type: str, id: str, table_sql: str, table_undo_sql:
def delete_link(name: str, link_type: str, id: str, table_sql: str, table_undo_sql: str) -> ChangeSet:
if not is_node(name, id):
return
return ChangeSet()
with conn[name].cursor(row_factory=dict_row) as cur:
sql = table_sql