I do not know if I am right or not. But, as I know, I cannot create a version change transaction manually. The only way to call this is to change the version number when opening an indexed database connection. If this is correct, will the new Store object never be created in Example 1 and Example 2?
Example 1
function createObjectStore(name){ var request2 = indexedDB.open("existingDB"); request2.onupgradeneeded = function() { var db = request2.result; var store = db.createObjectStore(name); }; }
Example 2
function createObjectStore(name){ var request2 = indexedDB.open("existingDB"); request2.onsuccess = function() { var db = request2.result; var store = db.createObjectStore(name); }; }
Example3 - This should work:
function createObjectStore(name){ var request2 = indexedDB.open("existingDB", 2); request2.onupgradeneeded = function() { var db = request2.result; var store = db.createObjectStore(name); }; }
If I want to create several Store objects in the same database , how can I get / get the database version before opening the database? So is there a way to automate this process of getting the database version number?
Is there any other way to create an objectStore other than this using the onupgradedededed handler.
Please, help. Many thanks.
Edit:
Here is the same problem as mine: https://groups.google.com/a/chromium.org/forum/#!topic/chromium-html5/0rfvwVdSlAs
javascript indexeddb
user1598696
source share