|
@ -18,7 +18,15 @@ function transaction(db, query, values) { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function insertFloodZone({ images, description, passable, location, date, time, address }) { |
|
|
|
|
|
|
|
|
function insertFloodZone({ |
|
|
|
|
|
images, |
|
|
|
|
|
description, |
|
|
|
|
|
passable, |
|
|
|
|
|
location, |
|
|
|
|
|
date, |
|
|
|
|
|
time, |
|
|
|
|
|
address, |
|
|
|
|
|
}) { |
|
|
const query = `INSERT INTO FloodZones(Description, Images, Latitude, Longitude, Passable, Date, Time, Address) VALUES(?, ?, ?, ?, ?, ?, ?, ?);`; |
|
|
const query = `INSERT INTO FloodZones(Description, Images, Latitude, Longitude, Passable, Date, Time, Address) VALUES(?, ?, ?, ?, ?, ?, ?, ?);`; |
|
|
if (location === undefined) { |
|
|
if (location === undefined) { |
|
|
console.debug("undefined location"); |
|
|
console.debug("undefined location"); |
|
@ -39,28 +47,41 @@ function insertFloodZone({ images, description, passable, location, date, time, |
|
|
transaction(global.userDataBase, query, values); |
|
|
transaction(global.userDataBase, query, values); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function insertPluviometerData({ pluviometer, description, images, dateTime, time, location, address }) { |
|
|
|
|
|
const query = `INSERT INTO Pluviometer(Date, Images, Latitude, Longitude, Precipitation, Address, Description) VALUES(?, ?, ?, ?, ?, ?, ?);`; |
|
|
|
|
|
|
|
|
function insertPluviometerData({ |
|
|
|
|
|
pluviometer, |
|
|
|
|
|
description, |
|
|
|
|
|
images, |
|
|
|
|
|
dateTime, |
|
|
|
|
|
time, |
|
|
|
|
|
}) { |
|
|
|
|
|
const query = `INSERT INTO PluviometerData(Date, Images, Precipitation, Description) VALUES(?, ?, ?, ?);`; |
|
|
|
|
|
|
|
|
if (location === undefined) { |
|
|
|
|
|
console.debug("undefined location"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// if (location === undefined) {
|
|
|
|
|
|
// console.debug("undefined location");
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
const values = [ |
|
|
const values = [ |
|
|
moment(dateTime).format("DD/MM/YYYY") +" | "+ moment(time).format("HH:mm"), |
|
|
|
|
|
|
|
|
moment(dateTime).format("DD/MM/YYYY") + |
|
|
|
|
|
" | " + |
|
|
|
|
|
moment(time).format("HH:mm"), |
|
|
JSON.stringify(images), |
|
|
JSON.stringify(images), |
|
|
parseFloat(location["latitude"]), |
|
|
|
|
|
parseFloat(location["longitude"]), |
|
|
|
|
|
parseFloat(pluviometer), |
|
|
parseFloat(pluviometer), |
|
|
address, |
|
|
|
|
|
description, |
|
|
description, |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
transaction(global.userDataBase, query, values); |
|
|
transaction(global.userDataBase, query, values); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function insertRainData({ images, description, rain, location, date, time, address }) { |
|
|
|
|
|
|
|
|
function insertRainData({ |
|
|
|
|
|
images, |
|
|
|
|
|
description, |
|
|
|
|
|
rain, |
|
|
|
|
|
location, |
|
|
|
|
|
date, |
|
|
|
|
|
time, |
|
|
|
|
|
address, |
|
|
|
|
|
}) { |
|
|
const query = `INSERT INTO RainLevel(RainIdx, Description, Images, Latitude, Longitude, Date, Time, Address) VALUES(?, ?, ?, ?, ?, ?, ?, ?);`; |
|
|
const query = `INSERT INTO RainLevel(RainIdx, Description, Images, Latitude, Longitude, Date, Time, Address) VALUES(?, ?, ?, ?, ?, ?, ?, ?);`; |
|
|
|
|
|
|
|
|
if (location === undefined) { |
|
|
if (location === undefined) { |
|
@ -70,7 +91,7 @@ function insertRainData({ images, description, rain, location, date, time, addre |
|
|
|
|
|
|
|
|
const values = [ |
|
|
const values = [ |
|
|
parseInt(rain), |
|
|
parseInt(rain), |
|
|
description, |
|
|
|
|
|
|
|
|
description, |
|
|
JSON.stringify(images), |
|
|
JSON.stringify(images), |
|
|
parseFloat(location["latitude"]), |
|
|
parseFloat(location["latitude"]), |
|
|
parseFloat(location["longitude"]), |
|
|
parseFloat(location["longitude"]), |
|
@ -84,7 +105,15 @@ function insertRainData({ images, description, rain, location, date, time, addre |
|
|
transaction(global.userDataBase, query, values); |
|
|
transaction(global.userDataBase, query, values); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function insertRiverData({ images, description, riverScale, location, date, time, address }) { |
|
|
|
|
|
|
|
|
function insertRiverData({ |
|
|
|
|
|
images, |
|
|
|
|
|
description, |
|
|
|
|
|
riverScale, |
|
|
|
|
|
location, |
|
|
|
|
|
date, |
|
|
|
|
|
time, |
|
|
|
|
|
address, |
|
|
|
|
|
}) { |
|
|
const query = `INSERT INTO RiverLevel(RiverIdx, Description, Images, Latitude, Longitude, Date, Time, Address) VALUES(?, ?, ?, ?, ?, ?, ?, ?);`; |
|
|
const query = `INSERT INTO RiverLevel(RiverIdx, Description, Images, Latitude, Longitude, Date, Time, Address) VALUES(?, ?, ?, ?, ?, ?, ?, ?);`; |
|
|
|
|
|
|
|
|
if (location === undefined) { |
|
|
if (location === undefined) { |
|
|