aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-04-29 13:41:15 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-04-29 13:41:15 +1200
commitf7198adaf371e08a72a837d417b29531c117c6ba (patch)
tree853fb51b64cd00aaa6e53d4e510bbf69859e7765 /src/org/traccar/database
parentcb0a3831c2d89a22e9f3b68d3ee17f6e2abdd424 (diff)
downloadtrackermap-server-f7198adaf371e08a72a837d417b29531c117c6ba.tar.gz
trackermap-server-f7198adaf371e08a72a837d417b29531c117c6ba.tar.bz2
trackermap-server-f7198adaf371e08a72a837d417b29531c117c6ba.zip
Store other data in position
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/DataManager.java27
1 files changed, 3 insertions, 24 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index e0bac5cd6..10b7c2b2f 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -188,30 +188,7 @@ public class DataManager {
params.setDouble("speed", position.getSpeed());
params.setDouble("course", position.getCourse());
params.setString("address", position.getAddress());
- params.setString("extended_info", position.getExtendedInfo());
-
- // DELME: Temporary compatibility support
- XPath xpath = XPathFactory.newInstance().newXPath();
- try {
- InputSource source = new InputSource(new StringReader(position.getExtendedInfo()));
- String index = xpath.evaluate("/info/index", source);
- if (!index.isEmpty()) {
- params.setLong("id", Long.valueOf(index));
- } else {
- params.setLong("id", null);
- }
- source = new InputSource(new StringReader(position.getExtendedInfo()));
- String power = xpath.evaluate("/info/power", source);
- if (!power.isEmpty()) {
- params.setDouble("power", Double.valueOf(power));
- } else {
- params.setLong("power", null);
- }
- } catch (XPathExpressionException e) {
- Log.warning("Error in XML: " + position.getExtendedInfo(), e);
- params.setLong("id", null);
- params.setLong("power", null);
- }
+ params.setString("extended_info", position.getOther());
return params;
}
@@ -273,6 +250,7 @@ public class DataManager {
"CREATE TABLE position (" +
"id INT PRIMARY KEY AUTO_INCREMENT," +
+ "protocol VARCHAR(1024)," +
"device_id INT NOT NULL," +
"server_time TIMESTAMP NOT NULL," +
"device_time TIMESTAMP NOT NULL," +
@@ -289,6 +267,7 @@ public class DataManager {
"CREATE TABLE data (" +
"id INT PRIMARY KEY AUTO_INCREMENT," +
+ "protocol VARCHAR(1024)," +
"device_id INT NOT NULL," +
"server_time TIMESTAMP NOT NULL," +
"device_time TIMESTAMP NOT NULL," +