adding info to db
This commit is contained in:
parent
7f62fc9bec
commit
81e79c1e67
@ -162,20 +162,7 @@ public class DeviceRequest extends PostRequest {
|
|||||||
break;
|
break;
|
||||||
case "addtodb":
|
case "addtodb":
|
||||||
// TODO: 18.01.20
|
// TODO: 18.01.20
|
||||||
|
//ResultSet seti = jdbc.executeUpdate("UPDATE devices SET `CityID`='" + id + "',`DeviceName`='" + params.get("devicename") + "',`DeviceLocation`='" + params.get("devicelocation") + "' WHERE `DeviceID`='" + params.get("deviceid") + "'"); ");
|
||||||
setunconfigured = jdbc.executeQuery("select * from cities WHERE `name`='" + params.get("cityname") + "' AND `zone`='" + params.get("zonename") + "' AND `wastetype`='" + params.get("wastetype") + "'");
|
|
||||||
try {
|
|
||||||
setunconfigured.last();
|
|
||||||
if (setunconfigured.getRow() != 1) {
|
|
||||||
// TODO: 17.01.20 error handling
|
|
||||||
} else {
|
|
||||||
int id = setunconfigured.getInt("id");
|
|
||||||
jdbc.executeUpdate("UPDATE devices SET `CityID`='" + id + "',`DeviceName`='" + params.get("devicename") + "',`DeviceLocation`='" + params.get("devicelocation") + "' WHERE `DeviceID`='" + params.get("deviceid") + "'");
|
|
||||||
sb.append("{\"success\":\"true\"}");
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
Loading…
Reference in New Issue
Block a user