aboutsummaryrefslogtreecommitdiff
path: root/debug.xml
diff options
context:
space:
mode:
authorDemian <demianalonso@gmail.com>2015-06-09 13:10:50 -0300
committerDemian <demianalonso@gmail.com>2015-06-09 13:11:38 -0300
commitb70876b7a3b852d0f0b9aade30d6a9405c054ac5 (patch)
treea08191b13ea2faaf3eec125f98c0c57d494ae487 /debug.xml
parentee4c07115d3bc3e58b92310f54bee7bd616ec669 (diff)
downloadtrackermap-server-b70876b7a3b852d0f0b9aade30d6a9405c054ac5.tar.gz
trackermap-server-b70876b7a3b852d0f0b9aade30d6a9405c054ac5.tar.bz2
trackermap-server-b70876b7a3b852d0f0b9aade30d6a9405c054ac5.zip
Moved all the SQL queries to the configuration file
Diffstat (limited to 'debug.xml')
-rw-r--r--debug.xml70
1 files changed, 70 insertions, 0 deletions
diff --git a/debug.xml b/debug.xml
index 6ca0c224a..bd747c97f 100644
--- a/debug.xml
+++ b/debug.xml
@@ -117,9 +117,78 @@
id INT PRIMARY KEY AUTO_INCREMENT);
</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
+ WHERE email = :email AND password = CAST(HASH('SHA256', STRINGTOUTF8(:password), 1000) AS VARCHAR);
+ </entry>
+
+ <entry key='database.selectUsersAll'>
+ SELECT * FROM user;
+ </entry>
+
+ <entry key='database.insertUser'>
+ INSERT INTO user (name, email, password, admin)
+ VALUES (:name, :email, CAST(HASH('SHA256', STRINGTOUTF8(:password), 1000) AS VARCHAR), :admin);
+ </entry>
+
+ <entry key='database.updateUser'>
+ UPDATE user SET
+ name = :name,
+ email = :email,
+ admin = :admin,
+ password = CASEWHEN((SELECT password FROM user WHERE id = :id) = :password, :password, CAST(HASH('SHA256', STRINGTOUTF8(:password), 1000) AS VARCHAR))
+ WHERE id = :id;
+ </entry>
+
+ <entry key='database.deleteUser'>
+ DELETE FROM user WHERE id = :id;
+ </entry>
+
+ <entry key='database.getPermissions'>
+ "SELECT userId, deviceId FROM user_device;"
+ </entry>
+
<entry key='database.selectDeviceAll'>
SELECT * FROM device;
</entry>
+
+ <entry key='database.selectDevices'>
+ SELECT * FROM device WHERE id IN (SELECT deviceId FROM user_device WHERE userId = :userId);
+ </entry>
+
+ <entry key='database.insertDevice'>
+ INSERT INTO device (name, uniqueId) VALUES (:name, :uniqueId);
+ </entry>
+
+ <entry key='database.updateDevice'>
+ UPDATE device SET name = :name, uniqueId = :uniqueId WHERE id = :id;
+ </entry>
+
+ <entry key='database.removeDevice'>
+ DELETE FROM device WHERE id = :id;
+ </entry>
+
+ <entry key='database.linkDevice'>
+ INSERT INTO user_device (userId, deviceId) VALUES (:userId, :deviceId);
+ </entry>
+
+ <entry key='database.selectPositions'>
+ SELECT * FROM position WHERE deviceId = :deviceId AND fixTime BETWEEN :from AND :to;
+ </entry>
<entry key='database.insertPosition'>
INSERT INTO position (deviceId, serverTime, deviceTime, fixTime, valid, latitude, longitude, altitude, speed, course, address, other)
@@ -130,6 +199,7 @@
UPDATE device SET positionId = :id WHERE id = :deviceId;
</entry>
+
<!-- PROTOCOL CONFIG -->
<entry key='detector.port'>5000</entry>