Tuesday, April 2, 2013

HTML5 with Sql database


I have created the sql database in HTML5 page .  it supports latest browsers like ie ,chrome
It is very simple and useful


There are three core methods in the spec that I’m going to cover in this article:
openDatabase
transaction
executeSql

I’ve passed four arguments to the openDatabase method. These are:
Database name
Version number
Text description
Estimated size of database  -  size might be 5Mb to 500 Mb. it varies on browser

executeSql

This is the funnel of love for all your SQL goodness. executeSql is used for both read and write statements, includes SQL injection projection, and provides a callback method to process the results of any queries you may have written.
Once we have a transaction object, we can call executeSql:
var db = openDatabase('mydb', '1.0', 'my first database', 2 *1024 * 1024);
db.transaction(function (tx) {
  tx.executeSql('CREATE TABLE foo (id unique, text)');
});

Example is below









Status Message



No comments:

Post a Comment