So, inside one function I have two queries, which is not a problem, I had other functions with over 7 queries. But, now I would like to insert JSON string inside SQLite database. It just does not work. I use this code so far:
function saveDataToDatabase() { saveFontValues(); saveColors(); // getCoordinatesOfBoxes(); db.transaction(function(tx){ tx.executeSql("CREATE TABLE IF NOT EXISTS template (id INTEGER NOT NULL PRIMARY KEY, colors TEXT, fonts TEXT)"); }); db.transaction(function(tx){ tx.executeSql("INSERT INTO template VALUES(?,?,?)"[null, colors, fonts]); }); }
Keep it in mind that colros and fonts are both JSON strings converted from Javascript object to string this way:
colors = JSON.stringify(colorObj);
Is it wrong that I choose TEXT as expected value for JSON in table? What should i pick? After all. json string is a string. Problem is that when I use console.log, I see all values for colors, but when I try to insert them, nothing happens.