diff options
-rw-r--r-- | debug.xml | 25 | ||||
-rw-r--r-- | src/org/traccar/database/DataManager.java | 8 |
2 files changed, 14 insertions, 19 deletions
@@ -117,22 +117,21 @@ id INT PRIMARY KEY AUTO_INCREMENT); </entry> + <entry key='database.selectServers'> + SELECT * FROM server; + </entry> + <entry key='database.insertServer'> INSERT INTO server (registration, latitude, longitude, zoom) VALUES (:registration, :latitude, :longitude, :zoom); </entry> - <entry key='database.selectServer'> - SELECT * FROM server; - </entry> - <entry key='database.updateServer'> UPDATE server SET registration = :registration WHERE id = :id; </entry> <entry key='database.loginUser'> - SELECT * - FROM user + SELECT * FROM user WHERE email = :email; </entry> @@ -144,12 +143,9 @@ INSERT INTO user (name, email, hashedPassword, salt, admin) VALUES (:name, :email, :hashedPassword, :salt, :admin); </entry> - + <entry key='database.updateUser'> - UPDATE user SET - name = :name, - email = :email, - admin = :admin + UPDATE user SET name = :name, email = :email, admin = :admin WHERE id = :id; </entry> @@ -161,11 +157,11 @@ DELETE FROM user WHERE id = :id; </entry> - <entry key='database.getPermissions'> + <entry key='database.getPermissionsAll'> SELECT userId, deviceId FROM user_device; </entry> - <entry key='database.selectDeviceAll'> + <entry key='database.selectDevicesAll'> SELECT * FROM device; </entry> @@ -181,7 +177,7 @@ UPDATE device SET name = :name, uniqueId = :uniqueId WHERE id = :id; </entry> - <entry key='database.removeDevice'> + <entry key='database.deleteDevice'> DELETE FROM device WHERE id = :id; </entry> @@ -202,7 +198,6 @@ UPDATE device SET positionId = :id WHERE id = :deviceId; </entry> - <!-- PROTOCOL CONFIG --> <entry key='detector.port'>5000</entry> diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 1aae7da4e..d8efaaaca 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -260,12 +260,12 @@ public class DataManager { } public Collection<Permission> getPermissions() throws SQLException { - return QueryBuilder.create(dataSource, properties.getProperty("database.getPermissions")) + return QueryBuilder.create(dataSource, properties.getProperty("database.getPermissionsAll")) .executeQuery(new Permission()); } public Collection<Device> getAllDevices() throws SQLException { - return QueryBuilder.create(dataSource, properties.getProperty("database.selectDeviceAll")) + return QueryBuilder.create(dataSource, properties.getProperty("database.selectDevicesAll")) .executeQuery(new Device()); } @@ -288,7 +288,7 @@ public class DataManager { } public void removeDevice(Device device) throws SQLException { - QueryBuilder.create(dataSource, properties.getProperty("database.removeDevice")) + QueryBuilder.create(dataSource, properties.getProperty("database.deleteDevice")) .setObject(device) .executeUpdate(); } @@ -320,7 +320,7 @@ public class DataManager { } public Server getServer() throws SQLException { - return QueryBuilder.create(dataSource, properties.getProperty("database.selectServer")) + return QueryBuilder.create(dataSource, properties.getProperty("database.selectServers")) .executeQuerySingle(new Server()); } |