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;