jeudi 24 décembre 2015

save json in HTML5 Web SQL Database

I am new in HTML5 Web SQL Database and I want save a JSON string.

 tx.executeSql("INSERT INTO TA (id, name) VALUES (89,\"{   \"items\":[     {     \"order\": 1,     \"item_id\": 123123,     \"quantity\": 10,     \"price\": 1526896,     \"total\": 15268960   },   {     \"order\": 2,     \"item_id\": 113124,     \"quantity\": 10,     \"price\": 1526896,     \"total\": 15268960   },   {     \"order\": 3,     \"item_id\": 163125,     \"quantity\": 10,     \"price\": 1626896,     \"total\": 16268960   },   {     \"order\": 4,     \"item_id\": 1723165,     \"quantity\": 10,     \"price\": 1726896,     \"total\": 17268960   },   {     \"order\": 5,     \"item_id\": 183190,     \"quantity\": 10,     \"price\": 1826896,     \"total\": 18268960   } ],  \"other\":[           {         \"order\": 1,         \"item\": 123123,         \"price\": 10              },      {         \"order\": 2,         \"item\": 123123,         \"price\": 10              }      ,{         \"order\": 3,         \"item\": 123123,         \"price\": 10      }      ] }\")";

But it not accept quotation marks in value.

I test this sample tx.executeSql("INSERT INTO TA (id, name) VALUES (90,\"a\")"); Also tx.executeSql("INSERT INTO TA (id, name) VALUES (90,\"\"a\"\")");

And get same result

Thank for all answers




Aucun commentaire:

Enregistrer un commentaire