aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--opengts.cfg43
-rw-r--r--src/org/traccar/model/DatabaseDataManager.java24
2 files changed, 43 insertions, 24 deletions
diff --git a/opengts.cfg b/opengts.cfg
index 11dbbbb2f..a47ca865a 100644
--- a/opengts.cfg
+++ b/opengts.cfg
@@ -7,36 +7,38 @@
<!-- Global confiduration -->
<entry key="database.driver">com.mysql.jdbc.Driver</entry>
<entry key="database.url">jdbc:mysql://localhost/gts?allowMultiQueries=true</entry>
- <entry key="database.user">user</entry>
- <entry key="database.password">password</entry>
+ <entry key="database.user">root</entry>
+ <entry key="database.password">root</entry>
<!-- Database refresh delay in seconds -->
<entry key="database.refreshDelay">300</entry>
- <!-->
- id - Integer
- imei - String
- <-->
<entry key="database.selectDevice">
SELECT imeiNumber AS id, imeiNumber AS imei FROM Device WHERE imeiNumber &lt;&gt; '';
</entry>
- <!-->
- 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)
- <-->
+ <entry key="database.insertDevice">
+ DO 0;
+ </entry>
+
+ <entry key="database.updateDevice">
+ DO 0;
+ </entry>
+
+ <entry key="database.deleteDevice">
+ DO 0;
+ </entry>
+
+ <entry key="database.selectPosition">
+ DO 0;
+ </entry>
+
<entry key="database.insertPosition">
START TRANSACTION;
UPDATE Device SET lastValidLatitude = :latitude, lastValidLongitude = :longitude, lastGPSTimestamp = UNIX_TIMESTAMP(:time), lastUpdateTime = UNIX_TIMESTAMP(NOW()) WHERE imeiNumber = :device_id;
SELECT @accountID := accountID, @deviceID := deviceID FROM Device WHERE imeiNumber = :device_id;
- INSERT INTO EventData VALUES (@accountID, @deviceID, UNIX_TIMESTAMP(:time), 0, :latitude, :longitude, 0, :speed, :course, 0, '', 0, '', '', '', 0, 0, 0, '0000000001', UNIX_TIMESTAMP(NOW()));
+ INSERT INTO EventData (accountID, deviceID, timestamp, statusCode, latitude, longitude, speedKPH, heading, altitude, rawData, creationTime)
+ VALUES (@accountID, @deviceID, UNIX_TIMESTAMP(:time), 0, :latitude, :longitude, :speed, :course, :altitude, '', UNIX_TIMESTAMP(NOW()));
COMMIT;
</entry>
@@ -88,4 +90,9 @@
<entry key="avl08.port">5007</entry>
<entry key="avl08.resetDelay">0</entry>
+ <!-- Enfora server configuration -->
+ <entry key="enfora.enable">true</entry>
+ <entry key="enfora.port">5008</entry>
+ <entry key="enfora.resetDelay">0</entry>
+
</properties>
diff --git a/src/org/traccar/model/DatabaseDataManager.java b/src/org/traccar/model/DatabaseDataManager.java
index ed3335342..733f0a0ec 100644
--- a/src/org/traccar/model/DatabaseDataManager.java
+++ b/src/org/traccar/model/DatabaseDataManager.java
@@ -72,22 +72,34 @@ public class DatabaseDataManager implements DataManager {
String query;
query = properties.getProperty("database.selectDevice");
- queryGetDevices = new NamedParameterStatement(connection, query);
+ if (query != null) {
+ queryGetDevices = new NamedParameterStatement(connection, query);
+ }
query = properties.getProperty("database.insertDevice");
- queryAddDevice = new NamedParameterStatement(connection, query);
+ if (query != null) {
+ queryAddDevice = new NamedParameterStatement(connection, query);
+ }
query = properties.getProperty("database.updateDevice");
- queryUpdateDevice = new NamedParameterStatement(connection, query);
+ if (query != null) {
+ queryUpdateDevice = new NamedParameterStatement(connection, query);
+ }
query = properties.getProperty("database.deleteDevice");
- queryRemoveDevice = new NamedParameterStatement(connection, query);
+ if (query != null) {
+ queryRemoveDevice = new NamedParameterStatement(connection, query);
+ }
query = properties.getProperty("database.selectPosition");
- queryGetPositions = new NamedParameterStatement(connection, query);
+ if (query != null) {
+ queryGetPositions = new NamedParameterStatement(connection, query);
+ }
query = properties.getProperty("database.insertPosition");
- queryAddPosition = new NamedParameterStatement(connection, query);
+ if (query != null) {
+ queryAddPosition = new NamedParameterStatement(connection, query);
+ }
// Create database schema
query = properties.getProperty("database.initialize");