Fix build error

This commit is contained in:
wqy
2024-01-13 15:02:22 +08:00
parent 37f5210ab9
commit 44edeffad9
25 changed files with 43 additions and 40 deletions

View File

@@ -3,16 +3,16 @@ from .database import *
def sql_update_coord(node: str, x: float, y: float) -> str:
coord = f"st_geomfromtext('point({x} {y})')"
return f"update coordinates set coord = {coord} where node = '{node}';"
return str(f"update coordinates set coord = {coord} where node = '{node}';")
def sql_insert_coord(node: str, x: float, y: float) -> str:
coord = f"st_geomfromtext('point({x} {y})')"
return f"insert into coordinates (node, coord) values ('{node}', {coord});"
return str(f"insert into coordinates (node, coord) values ('{node}', {coord});")
def sql_delete_coord(node: str) -> str:
return f"delete from coordinates where node = '{node}';"
return str(f"delete from coordinates where node = '{node}';")
def from_postgis_point(coord: str) -> dict[str, float]:
@@ -43,7 +43,7 @@ def inp_in_coord(line: str) -> str:
tokens = line.split()
node = tokens[0]
coord = f"st_geomfromtext('point({tokens[1]} {tokens[2]})')"
return f"insert into coordinates (node, coord) values ('{node}', {coord});"
return str(f"insert into coordinates (node, coord) values ('{node}', {coord});")
def inp_out_coord(name: str) -> list[str]: