Fix remove queries and exit loop
This commit is contained in:
parent
1a3190ad40
commit
86200a9afc
|
@ -112,7 +112,7 @@ func MainCliLoop(db *sql.DB) {
|
|||
if todo == "r" {
|
||||
logic.RemoveFromStorage(db, location)
|
||||
} else if todo == "n" {
|
||||
continue
|
||||
break
|
||||
} else {
|
||||
fmt.Printf("Unrecognized option: %s\n", todo)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package database
|
|||
import "database/sql"
|
||||
|
||||
func RemoveFromBinder(db *sql.DB, location LocateCardResult) error {
|
||||
query := `UPDATE CardStorageLocation SET CardPrintingId = NULL WHERE Id = ?;`
|
||||
query := `UPDATE CardLocation SET CardPrintingId = NULL WHERE Id = ?;`
|
||||
|
||||
update, err := db.Prepare(query)
|
||||
defer update.Close()
|
||||
|
@ -20,7 +20,7 @@ func RemoveFromBinder(db *sql.DB, location LocateCardResult) error {
|
|||
}
|
||||
|
||||
func RemoveFromBox(db *sql.DB, location LocateCardResult) error {
|
||||
deleteQuery := `DELETE FROM CardStorageLocation WHERE Id = ?;`
|
||||
deleteQuery := `DELETE FROM CardLocation WHERE Id = ?;`
|
||||
|
||||
del, err := db.Prepare(deleteQuery)
|
||||
defer del.Close()
|
||||
|
@ -33,7 +33,7 @@ func RemoveFromBox(db *sql.DB, location LocateCardResult) error {
|
|||
return err
|
||||
}
|
||||
|
||||
updateQuery := `UPDATE CardStorageLocation SET Position = Position - 1 WHERE Position > ? AND StorageAreaId = ?;`
|
||||
updateQuery := `UPDATE CardLocation SET Position = Position - 1 WHERE Position > ? AND StorageAreaId = ?;`
|
||||
|
||||
update, err := db.Prepare(updateQuery)
|
||||
defer update.Close()
|
||||
|
|
Loading…
Reference in New Issue