From aa289b8600d9a55fdd053e003705de116ab25f2e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 11 Oct 2015 13:50:13 +1300 Subject: Make changes to model hierarchy --- debug.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'debug.xml') diff --git a/debug.xml b/debug.xml index 5350536a1..5192dcb8b 100644 --- a/debug.xml +++ b/debug.xml @@ -111,6 +111,7 @@ deviceId INT NOT NULL, serverTime TIMESTAMP NOT NULL, deviceTime TIMESTAMP NOT NULL, + type VARCHAR(128), attributes VARCHAR(4096) NOT NULL, FOREIGN KEY (deviceId) REFERENCES device (id) ON DELETE CASCADE); @@ -244,6 +245,23 @@ UPDATE device SET positionId = :id WHERE id = :deviceId; + + SELECT * FROM data WHERE deviceId = :deviceId AND deviceTime BETWEEN :from AND :to ORDER BY deviceTime; + + + + INSERT INTO data (deviceId, protocol, serverTime, deviceTime, type, attributes) + VALUES (:deviceId, :protocol, CURRENT_TIMESTAMP(), :time, :type, :attributes); + + + + SELECT * FROM data WHERE id IN (SELECT dataId FROM device); + + + + UPDATE device SET dataId = :id WHERE id = :deviceId; + + -- cgit v1.2.3