Currently am inserting one single value into db using SQL in javascript (Phonegap application)
the following code am using to insert a value into db.
But when i tried to run that INSERT query in a loop it showing memory issues like 2.05GB memory used on run time
function populateDB(tx) {
var newsArray=new Array();
newsArray[0]="one";
newsArray[1]="two";
newsArray[2]="three";
newsArray[3]="four";
newsArray[4]="five";
tx.executeSql('DROP TABLE IF EXISTS NEWS');
tx.executeSql('CREATE TABLE IF NOT EXISTS NEWS (id PRIMARY KEY AUTO INCREMENT ,news TEXT NOT NULL)');
var i=0;
while(i<newsArray.length){
tx.executeSql('INSERT INTO NEWS (news) VALUES ('newsArray[i]')');
i++;
}
//Dropping and adding makes sure there is one entry of the news item.
//You may actually cache multiple copies and make it a feature as well.
}