You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
914 B

import "../config/globals";
function transaction(db, query, values) {
db.transaction((tx) => {
tx.executeSql(
query,
values,
(_, results) => {
console.debug("Values inserted successfully" + results.rowsAffected);
},
(_, err) => {
console.debug("Error while inserting values: " + JSON.stringify(err));
}
);
});
}
function insertFloodZone({ images, description, passable, location }) {
const query = `INSERT INTO FloodZones(Description, Images, Latitude, Longitude, Passable) VALUES(?, ?, ?, ?, ?);`;
if (location === undefined) {
console.debug("undefined location");
return;
}
const values = [
description,
JSON.stringify(images),
parseFloat(location["latitude"]),
parseFloat(location["longitude"]),
parseInt(passable),
];
transaction(global.userDataBase, query, values);
}
export default insertFloodZone;