api.spaceplanner.app

Spaceplanner API
git clone git://jacobedwards.org/api.spaceplanner.app
Log | Files | Refs

commit b455efa4199999c2c554cb1239df1b253ae8a780
parent 779e748fa09912152011ac694499f1ad65f15bda
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Mon, 26 Aug 2024 14:20:12 -0700

Fix a few sql statements

There was one invalid statement, and another which was expected to
return a few columns but did not.

Diffstat:
Minternal/backend/floorplan_data.go | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/internal/backend/floorplan_data.go b/internal/backend/floorplan_data.go @@ -146,7 +146,7 @@ func (e *Env) ReplaceFloorplanData(tx *sql.Tx, user string, floorplan string, da func (e *Env) DeleteFloorplanData(tx *sql.Tx, user string, floorplan string) error { stmt, err := e.CacheTxStmt(tx, "del_floorplan_data", - `DELETE from spaceplanner.floorplan_points + `DELETE FROM spaceplanner.floorplan_points WHERE floorplan = spaceplanner.floorplan_id($1, $2)`) if err != nil { return err @@ -343,7 +343,8 @@ func (e *Env) replacePoint(tx *sql.Tx, user string, floorplan string, point Poin func (e *Env) deletePoint(tx *sql.Tx, user string, floorplan string, id int64) (Point, error) { stmt, err := e.CacheTxStmt(tx, "dele_point", - `DELETE spaceplanner.floorplan_points WHERE floorplan = floorplan_id($1, $2) AND id = $3`) + `DELETE FROM spaceplanner.floorplan_points WHERE floorplan = floorplan_id($1, $2) AND id = $3 + RETURNING id, x, y`) if err != nil { return Point{}, err } @@ -378,7 +379,8 @@ func (e *Env) replacePointMap(tx *sql.Tx, user string, floorplan string, pointma func (e *Env) deletePointMap(tx *sql.Tx, user string, floorplan string, id int64) (PointMap, error) { stmt, err := e.CacheTxStmt(tx, "dele_pointmap", `DELETE FROM spaceplanner.floorplan_pointmaps - WHERE floorplan = floorplan_id($1, $2) AND id = $3`) + WHERE floorplan = floorplan_id($1, $2) AND id = $3 + RETURNING id, type, a, b`) if err != nil { return PointMap{}, err }