diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-10 15:45:55 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-10 15:45:55 +1200 |
commit | ee087f587a96700d91e407d434e94d1616c18368 (patch) | |
tree | fc9642ed3159dd16ebd1c5448233b251b091921c /debug.xml | |
parent | ee4c07115d3bc3e58b92310f54bee7bd616ec669 (diff) | |
parent | 96a2d024658746f50628727f7255c4e19ecdb1b4 (diff) | |
download | trackermap-server-ee087f587a96700d91e407d434e94d1616c18368.tar.gz trackermap-server-ee087f587a96700d91e407d434e94d1616c18368.tar.bz2 trackermap-server-ee087f587a96700d91e407d434e94d1616c18368.zip |
Merge pull request #1240 from demianalonso/master
Move SQL queries to the config file
Diffstat (limited to 'debug.xml')
-rw-r--r-- | debug.xml | 83 |
1 files changed, 78 insertions, 5 deletions
@@ -42,7 +42,7 @@ CREATE TABLE user ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(1024) NOT NULL, - email VARCHAR(1024) NOT NULL UNIQUE, + email VARCHAR(256) NOT NULL UNIQUE, password VARCHAR(1024) NOT NULL, salt VARCHAR(1024) DEFAULT '' NOT NULL, readonly BOOLEAN DEFAULT false NOT NULL, @@ -58,7 +58,7 @@ CREATE TABLE device ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(1024) NOT NULL, - uniqueId VARCHAR(1024) NOT NULL UNIQUE, + uniqueId VARCHAR(256) NOT NULL UNIQUE, status VARCHAR(1024), lastUpdate TIMESTAMP, positionId INT, @@ -67,8 +67,8 @@ CREATE TABLE user_device ( userId INT NOT NULL, deviceId INT NOT NULL, - read BOOLEAN DEFAULT true NOT NULL, - write BOOLEAN DEFAULT true NOT NULL, + `read` BOOLEAN DEFAULT true NOT NULL, + `write` BOOLEAN DEFAULT true NOT NULL, FOREIGN KEY (userId) REFERENCES user(id) ON DELETE CASCADE, FOREIGN KEY (deviceId) REFERENCES device(id) ON DELETE CASCADE); @@ -101,7 +101,7 @@ FOREIGN KEY (deviceId) REFERENCES device(id)); ALTER TABLE device ADD - FOREIGN KEY (positionId) REFERENCES position(id); + FOREIGN KEY (positionId) REFERENCES `position`(id); ALTER TABLE device ADD FOREIGN KEY (dataId) REFERENCES data(id); @@ -117,9 +117,81 @@ 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 = :password; + </entry> + + <entry key='database.selectUsersAll'> + SELECT * FROM user; + </entry> + + <entry key='database.insertUser'> + INSERT INTO user (name, email, password, admin) + VALUES (:name, :email, :password, :admin); + </entry> + + <entry key='database.updateUser'> + UPDATE user SET + name = :name, + email = :email, + admin = :admin + WHERE id = :id; + </entry> + + <entry key='database.updateUserPassword'> + UPDATE user SET password = :password 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 +202,7 @@ UPDATE device SET positionId = :id WHERE id = :deviceId; </entry> + <!-- PROTOCOL CONFIG --> <entry key='detector.port'>5000</entry> |