I have developed application using HTML 5 Localstorage.
How can I create a TABLE and populate 10000+ rows before initializing my HTML 5 enabled application.
Please suggest a pattern.
What Does Default Values - Database Mean? Default values, in the context of databases, are preset values defined for a column type. Default values are used when many records hold similar data.
The data and transaction log files are stored in the root of the database directory. The database directory is the folder location specified when the database is created.
Local database would be SQLite in android. It can be accessed locally only. A server database is hosted in a remote server. Basically It can be accessed by any client in the web. An example of local use would be for example storing credentials or information that you don't want/need to share with another user.
var db = openDatabase('dbname', 'dbversion 1.0', 'description', 64*1024);
db.transaction(function (query){
query.executeSql('CREATE TABLE IF NOT EXISTS tablename (id unique, value)');
var rows = 10000, i;
for(i=0; i < rows; i++){
query.executeSql('INSERT INTO tablename (id, value) VALUES ('+ i + ', "Stackoverflow")');
}
query.executeSql('SELECT * FROM tablename', [], function (query, results) {
for (i = 0; i < 5; i++) {
alert(results.rows.item(i).text);
}
});
});
//Do magic with your webapp now
The queries accepted are SQLite type. Check the official specification for more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With