summaryrefslogtreecommitdiff
path: root/database/systems.js
diff options
context:
space:
mode:
authorJulien Dessaux2023-06-01 01:11:21 +0200
committerJulien Dessaux2023-06-01 01:11:21 +0200
commit68c457964a02d290f3fe225b090c549d664bb836 (patch)
tree4b63ee97f5439621536594c59f25b1c35c353b37 /database/systems.js
parentReworked the systems handling and caching with sqlite (diff)
downloadspacetraders-68c457964a02d290f3fe225b090c549d664bb836.tar.gz
spacetraders-68c457964a02d290f3fe225b090c549d664bb836.tar.bz2
spacetraders-68c457964a02d290f3fe225b090c549d664bb836.zip
Another big refactoring
Diffstat (limited to 'database/systems.js')
-rw-r--r--database/systems.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/database/systems.js b/database/systems.js
index e3822d3..337126c 100644
--- a/database/systems.js
+++ b/database/systems.js
@@ -1,7 +1,7 @@
import db from './db.js';
-const getSystemStatement = db.prepare(`SELECT data from systems where json_extract(data, '$.symbol') = ?;`);
-const getSystemUpdatedStatement = db.prepare(`SELECT updated from systems where json_extract(data, '$.symbol') = ?;`);
+const getSystemStatement = db.prepare(`SELECT data FROM systems WHERE json_extract(data, '$.symbol') = ?;`);
+const getSystemUpdatedStatement = db.prepare(`SELECT updated FROM systems WHERE json_extract(data, '$.symbol') = ?;`);
const setSystemStatement = db.prepare(`INSERT INTO systems(data) VALUES (json(?));`);
const setSystemWaypointsStatement = db.prepare(`UPDATE systems SET data = (SELECT json_set(data, '$.waypoints', json(:waypoints)) FROM systems WHERE json_extract(data, '$.symbol') = :symbol), updated = :date WHERE json_extract(data, '$.symbol') = :symbol;`);
@@ -61,7 +61,7 @@ export function setSystemWaypoints(symbol, waypoints) {
date: new Date().toISOString(),
symbol: symbol,
waypoints: JSON.stringify(waypoints),
- });
+ }).changes;
} catch (err) {
console.log(err);
return null;