0

I use websql for offline storage. Following addItem function works for other browsers, except Chromium:

  itemset.webdb.createTable = function() {
     var db = itemset.webdb.db;
     db.transaction(function(tx) {
      tx.executeSql("CREATE TABLE IF NOT EXISTS items(ID INTEGER PRIMARY KEY ASC,        
          item_name TEXT, desp TEXT, due_date DATE)", []);
    });
  }

   itemset.webdb.addItem = function(item_name, desp, due_date) {
        var db = itemset.webdb.db;
        db.transaction(function(tx){
          //var added_on = new Date();
          tx.executeSql("INSERT INTO items(item_name, desp, due_date) VALUES (?,?,?)",
              [item_name,desp,due_date],
              itemset.webdb.onSuccess,
              itemset.webdb.onError);
         });
      }

Chromium gives error: "There has been an error: could not prepare statement (1 table items has no column named due_date)". Why it does not work?

Ali Ismayilov
  • 1,707
  • 3
  • 22
  • 37

2 Answers2

1

just have to add the new field in to table, for example next code :

db.transaction(function(txt))
{
    txt.executeSql("ALTER TABLE items ADD item_name TEXT, desp TEXT, due_date DATE");
}
Dave Hogan
  • 3,201
  • 6
  • 29
  • 54
leo
  • 11
  • 1
0

Create new table name or Drop and create the table.

mzonerz
  • 1,220
  • 15
  • 22