SlideShare a Scribd company logo
Web storage
Web storage
Web storage
Web storage
Web storage
Web storage
Web storage
key/value
Web storage
Web storage
Web storage
Web storage
Web storage
Web storage
transaction()
    1     :


    2     :

    3     :
Web storage
executeSql()
   1     :


   2     :

   3     :
Web storage
Web storage
Web storage
Web storage
dev.w3.org/html5/webdatabase



   This specification has reached an impasse
key/value
Indexed Database
Indexed Database API
// DB
var request = window.indexedDB.open(
    "CandyDB",
    "My candy store database");

request.onsuccess = function(event) {
  var db = event.result;
  if (db.version != "1") {

      //

  } else {

      //
      loadData(db);
  }
};
//
var createdObjectStoreCount = 0;
var objectStores = [
   { name: "kids", keyPath: "id", autoIncrement: true },
   { name: "candy", keyPath: "id", autoIncrement: true },
   { name: "candySales", keyPath: "", autoIncrement: true }
];

function objectStoreCreated(event) {
  if (++createdObjectStoreCount == objectStores.length) {
    db.setVersion("1").onsuccess = function(event) {
       loadData(db);
    };
  }
}

for (var index = 0; index < objectStores.length; index++) {
  var params = objectStores[index];
  //    DB
    request = db.createObjectStore(params.name, params.keyPath,
                                   params.autoIncrement);
    //
    request.onsuccess = objectStoreCreated;
}
var   kids = [
  {   name: "Anna" },
  {   name: "Betty" },
  {   name: "Christine" }
];

// DB
var request = window.indexedDB.open(
    "CandyDB",
    "My candy store database");

request.onsuccess = function(event) {
  var objectStore = event.result.objectStore("kids");
  for (var index = 0; index < kids.length; index++) {
    var kid = kids[index];
    //
      objectStore.add(kid).onsuccess = function(event) {
         document.getElementById("display").textContent =
           "Saved record for "+kid.name+" with id "+event.result;
      };
  }
};
// DB
var request = window.indexedDB.open(
    "CandyDB",
    "My candy store database");

request.onsuccess = function(event) {
  //
  request = event.result.objectStore("kids").openCursor();
  request.onsuccess = function(event) {
    var cursor = event.result;
    // cursor    null
    if (!cursor) {
      return;
    }
    var element = document.createElement("div");
    element.textContent = cursor.value.name;
    document.getElementById("kidList").appendChild(element);
    cursor.continue();
  };
};
Web Storage
http://dev.w3.org/html5/webstorage/Overview.html

Web SQL Database
http://dev.w3.org/html5/webdatabase/

Indexed Database
http://www.w3.org/TR/IndexedDB/

Firefox 4    Indexed Database API
https://dev.mozilla.jp/hacksmozillaorg/firefox-4-an-early-walk-through-of-
indexeddb/


Simple to-do list with jQuery and local storage.
http://www.tuttoaster.com/tag/html5/

More Related Content

PPT
Mysocial databasequeries
PPT
Mysocial databasequeries
DOCX
Karan - form search
PDF
Agile Data concept introduction
PDF
윈도우 8의 새로운 컨트롤과 개발시 알아야 할 점들
PDF
Diving into php
PPTX
Magento Dependency Injection
KEY
Special Events
Mysocial databasequeries
Mysocial databasequeries
Karan - form search
Agile Data concept introduction
윈도우 8의 새로운 컨트롤과 개발시 알아야 할 점들
Diving into php
Magento Dependency Injection
Special Events

What's hot (20)

PPTX
Azure Table Storage: The Good, the Bad, the Ugly (10 min. lightning talk)
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day - Buenos Aires
PDF
Who's afraid of front end databases?
PPT
Hi5 Opensocial Code Lab Presentation
PDF
Short intro to JQuery and Modernizr
PPTX
Jquery introduce
PPTX
PPT
Introduction to j query
ODP
Consume Spring Data Rest with Angularjs
PPSX
JQuery Comprehensive Overview
PPTX
Css Selectors
PDF
Django at the Disco
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
PDF
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
ZIP
Django at the Disco
PPT
Don't Worry jQuery is very Easy:Learning Tips For jQuery
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
PPTX
Jquery Basics
PPTX
Javascript Php Crud
KEY
You Can Kick-Ass Too, AtlasCamp US 2012
Azure Table Storage: The Good, the Bad, the Ugly (10 min. lightning talk)
JavaScript APIs - The Web is the Platform - MDN Hack Day - Buenos Aires
Who's afraid of front end databases?
Hi5 Opensocial Code Lab Presentation
Short intro to JQuery and Modernizr
Jquery introduce
Introduction to j query
Consume Spring Data Rest with Angularjs
JQuery Comprehensive Overview
Css Selectors
Django at the Disco
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
Django at the Disco
Don't Worry jQuery is very Easy:Learning Tips For jQuery
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
Jquery Basics
Javascript Php Crud
You Can Kick-Ass Too, AtlasCamp US 2012
Ad

Viewers also liked (8)

PDF
Wordbench fukuoka
PDF
Word Camp Fukuoka 2010
PDF
20120427西区勉強会
PDF
Word benchfukuoka
PDF
Wordbench fukuoka
PDF
PHP7を実際に動かしてみた@第96回PHP勉強会 #phpstudy
PPTX
PHPバージョン別応答速度比較
PPTX
SORACOM interstellar 紹介資料
Wordbench fukuoka
Word Camp Fukuoka 2010
20120427西区勉強会
Word benchfukuoka
Wordbench fukuoka
PHP7を実際に動かしてみた@第96回PHP勉強会 #phpstudy
PHPバージョン別応答速度比較
SORACOM interstellar 紹介資料
Ad

Similar to Web storage (20)

PDF
Taking Web Apps Offline
ODP
Indexed db
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
PPTX
Html indexed db
PDF
The Open Web and what it means
PDF
HTML5 APIs - Where no man has gone before! - Altran
PDF
JavaScript APIs - The Web is the Platform - .toster conference, Moscow
PDF
WooCommerce CRUD and Data Store by Akeda Bagus
PPTX
Jquery introduction
PPTX
IndexedDB - Querying and Performance
PDF
Who's afraid of front end databases
KEY
The Principle of Hybrid App.
KEY
Intro to IndexedDB (Beta)
PDF
Whos afraid of front end databases?
PDF
jQuery secrets
PDF
22 j query1
PDF
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
KEY
jQuery: Tips, tricks and hints for better development and Performance
PPTX
Designing a ui for microservices @ .NET Day Switzerland 2019
PDF
Practical Event Sourcing
Taking Web Apps Offline
Indexed db
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
Html indexed db
The Open Web and what it means
HTML5 APIs - Where no man has gone before! - Altran
JavaScript APIs - The Web is the Platform - .toster conference, Moscow
WooCommerce CRUD and Data Store by Akeda Bagus
Jquery introduction
IndexedDB - Querying and Performance
Who's afraid of front end databases
The Principle of Hybrid App.
Intro to IndexedDB (Beta)
Whos afraid of front end databases?
jQuery secrets
22 j query1
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
jQuery: Tips, tricks and hints for better development and Performance
Designing a ui for microservices @ .NET Day Switzerland 2019
Practical Event Sourcing

Web storage

  • 15. transaction() 1 : 2 : 3 :
  • 17. executeSql() 1 : 2 : 3 :
  • 22. dev.w3.org/html5/webdatabase This specification has reached an impasse
  • 25. // DB var request = window.indexedDB.open( "CandyDB", "My candy store database"); request.onsuccess = function(event) { var db = event.result; if (db.version != "1") { // } else { // loadData(db); } };
  • 26. // var createdObjectStoreCount = 0; var objectStores = [ { name: "kids", keyPath: "id", autoIncrement: true }, { name: "candy", keyPath: "id", autoIncrement: true }, { name: "candySales", keyPath: "", autoIncrement: true } ]; function objectStoreCreated(event) { if (++createdObjectStoreCount == objectStores.length) { db.setVersion("1").onsuccess = function(event) { loadData(db); }; } } for (var index = 0; index < objectStores.length; index++) { var params = objectStores[index]; // DB request = db.createObjectStore(params.name, params.keyPath, params.autoIncrement); // request.onsuccess = objectStoreCreated; }
  • 27. var kids = [ { name: "Anna" }, { name: "Betty" }, { name: "Christine" } ]; // DB var request = window.indexedDB.open( "CandyDB", "My candy store database"); request.onsuccess = function(event) { var objectStore = event.result.objectStore("kids"); for (var index = 0; index < kids.length; index++) { var kid = kids[index]; // objectStore.add(kid).onsuccess = function(event) { document.getElementById("display").textContent = "Saved record for "+kid.name+" with id "+event.result; }; } };
  • 28. // DB var request = window.indexedDB.open( "CandyDB", "My candy store database"); request.onsuccess = function(event) { // request = event.result.objectStore("kids").openCursor(); request.onsuccess = function(event) { var cursor = event.result; // cursor null if (!cursor) { return; } var element = document.createElement("div"); element.textContent = cursor.value.name; document.getElementById("kidList").appendChild(element); cursor.continue(); }; };
  • 29. Web Storage http://dev.w3.org/html5/webstorage/Overview.html Web SQL Database http://dev.w3.org/html5/webdatabase/ Indexed Database http://www.w3.org/TR/IndexedDB/ Firefox 4 Indexed Database API https://dev.mozilla.jp/hacksmozillaorg/firefox-4-an-early-walk-through-of- indexeddb/ Simple to-do list with jQuery and local storage. http://www.tuttoaster.com/tag/html5/

Editor's Notes

  • #6: Session Storage &amp;#x30B5;&amp;#x30A4;&amp;#x30C8;&amp;#x306F;&amp;#x3001;&amp;#x30BB;&amp;#x30C3;&amp;#x30B7;&amp;#x30E7;&amp;#x30F3;&amp;#x30FB;&amp;#x30B9;&amp;#x30C8;&amp;#x30EC;&amp;#x30FC;&amp;#x30B8;&amp;#x306B;&amp;#x30C7;&amp;#x30FC;&amp;#x30BF;&amp;#x3092;&amp;#x52A0;&amp;#x3048;&amp;#x308B;&amp;#x3053;&amp;#x3068;&amp;#x304C;&amp;#x3067;&amp;#x304D;&amp;#x3001;&amp;#x305D;&amp;#x306E;&amp;#x30A6;&amp;#x30A3;&amp;#x30F3;&amp;#x30C9;&amp;#x30A6;&amp;#x3067;&amp;#x958B;&amp;#x304B;&amp;#x308C;&amp;#x3066;&amp;#x3044;&amp;#x308B;&amp;#x540C;&amp;#x3058;&amp;#x30B5;&amp;#x30A4;&amp;#x30C8;&amp;#x306E;&amp;#x3069;&amp;#x3093;&amp;#x306A;&amp;#x30DA;&amp;#x30FC;&amp;#x30B8;&amp;#x304B;&amp;#x3089;&amp;#x3067;&amp;#x3082;&amp;#x30A2;&amp;#x30AF;&amp;#x30BB;&amp;#x30B9;&amp;#x3059;&amp;#x308B;&amp;#x3053;&amp;#x3068;&amp;#x304C;&amp;#x3067;&amp;#x304D;&amp;#x308B;&amp;#x3088;&amp;#x3046;&amp;#x306B;&amp;#x306A;&amp;#x308A;&amp;#x307E;&amp;#x3059;&amp;#x3002;