org.h2.Driver
jdbc:h2:[DATABASE]
sa
300
CREATE TABLE IF NOT EXISTS devices (id INT IDENTITY, imei VARCHAR(16));
CREATE TABLE IF NOT EXISTS positions (device_id INT, time TIMESTAMP, valid BOOLEAN, latitude DOUBLE, longitude DOUBLE, speed DOUBLE, course DOUBLE, power DOUBLE);
id - Integer
imei - String
<-->
SELECT id, imei
FROM devices;
imei - String
<-->
INSERT INTO devices (imei)
VALUES (:imei);
id - Integer
imei - String
<-->
UPDATE devices
SET imei = :imei
WHERE id = :id;
id - Integer
<-->
DELETE FROM devices
WHERE id = :id;
device_id - Integer
<-->
SELECT *
FROM positions
WHERE device_id = :device_id
ORDER by time DESC;
device_id - Integer
time - Date
valid - Boolean
latitude - Double
longitude - Double
speed - Double
course - Double
power - Double (NULL for some protocols)
extended_info - String (XML)
<-->
INSERT INTO positions (device_id, time, valid, latitude, longitude, speed, course, power)
VALUES (:device_id, :time, :valid, :latitude, :longitude, :speed, :course, :power);
true
8082
true
[LOG]
true
5000
true
5001
true
5002
true
5003
true
5004
true
5005
true
5006
true
5007
true
5008
true
5009
true
5010
true
5011
true
5012
true
5013
true
5014
true
5015
true
5016