indexeddb

Query using multiple conditions

ぃ、小莉子 提交于 2019-12-18 11:01:48
问题 I recently discovered (sadly) that WebSQL is no longer being supported for HTML5 and that IndexedDB will be replacing it instead. I'm wondering if there is any way to query or search through the entries of an IndexedDB in a similar way to how I can use SQL to search for an entry satisfying multiple conditions. I've seen that I can search through IndexedDB using one condition with the KeyRange. However, I can't seem to find any way to search two or more columns of data without grabbing all the

Ember async computed property returns undefined

久未见 提交于 2019-12-18 09:12:25
问题 I am attempting to set a property to the value of a model's async, hasMany relationship. But I'm not able to return any value within the then function. App.Athlete = DS.Model.extend({ name: DS.attr('string'), age: DS.attr('number'), splits: DS.hasMany('split', {async: true}), times: DS.hasMany('time', {async: true}), }); App.Time = DS.Model.extend({ athlete: DS.belongsTo('athlete', {async:true}), race: DS.belongsTo('race', {async: true}), time: DS.attr('string'), }); App.Split = DS.Model

How do you keep an indexeddb transaction alive?

梦想的初衷 提交于 2019-12-18 03:33:14
问题 Instead of opening several transactions (read a table, write to a table, write to another table, etc) is it possible to do this all from a single transaction as long as you are using an appropriate IDBTransaction? Mozilla says: "The only way to keep the transaction active is to make a request on it. When the request is finished you'll get a DOM event and, assuming that the request succeeded, you'll have another opportunity to extend the transaction during that callback." which is a little

How can I make a really long string using IndexedDB without crashing the browser?

血红的双手。 提交于 2019-12-18 01:30:14
问题 I'm writing a web app that generates a potentially large text file that the user will download, and all the processing is done in the browser. So far I'm able to read a file over 1 GB in small chunks, process each chunk, generate a large output file incrementally, and store the growing output in IndexedDB. My more naïve attempt which kept all the results in memory and then serialized them to a file at the very end was causing all browsers to crash. My question is two-fold: Can I append to an

Uncaught TypeError: Cannot read property 'transaction' of null with an indexeddb

末鹿安然 提交于 2019-12-17 20:37:35
问题 I am getting an error 'Uncaught TypeError: Cannot read property 'transaction' of null ' when in this section of code remoteDB.indexedDB.addAdmins = function() { var db = remoteDB.indexedDB.db; var trans = db.transaction("students", "readwrite"); var request = trans.objectStore("administrators"); /* this section edited out since the failure is on line 3 */ request.onsuccess = function(e) { console.log("success Adding: ", e); }; request.onerror = function(e) { console.log(e.value); }; }; 回答1:

Javascript: Searching indexeddb using multiple indexes

流过昼夜 提交于 2019-12-17 18:29:08
问题 I want to change from WebSql to Indexeddb. However, how would one do SQL queries like SELECT * FROM customers WHERE ssn = '444-44-4444' and emal = 'bill@bill@company.com' SELECT * FROM customers WHERE ssn = '444-44-4444' and emal = 'bill@bill@company.com' and age = 30 SELECT * FROM customers WHERE ssn = '444-44-4444' and emal = 'bill@bill@company.com' and name = 'Bill' etc with IndexedDB ? For example, I noticed while reading the documentation of indexedDb, that all the examples only query

How to access Google Chrome's IndexedDB/LevelDB files?

人走茶凉 提交于 2019-12-17 16:15:11
问题 I want to use Google Chrome's IndexedDB to persist data on the client-side. Idea is to access the IndexedDB outside of chrome, via Node.JS, later on. The background is the idea to track usage behaviour locally and store the collected data on the client for later analysis without a server backend. From my understanding, the indexedDB is implemented as a LevelDB. However, I cannot open the levelDB with any of the tools/libs like LevelUp/LevelDown or leveldb-json. I'm always getting this error

How to create multiple object stores in IndexedDB

老子叫甜甜 提交于 2019-12-17 14:03:56
问题 I don't know if I'm right or wrong. But as I know I can't create a version change transaction manually. The only way to invoke this is by changing the version number when opening the indexed DB connection. If this is correct, in example1 and example2 new objectStore will never be created? Example1 function createObjectStore(name){ var request2 = indexedDB.open("existingDB"); request2.onupgradeneeded = function() { var db = request2.result; var store = db.createObjectStore(name); }; } Example2

IndexedDB工具函数

泄露秘密 提交于 2019-12-15 01:19:20
/* * @author visy.wang * @date 2019/12/9 17:17 */ //IDB.js export default { //创建一个数据库连接 (如果指定的数据库不存在则会新建一个数据库) //dbName:string 数据库名称,必填 //version:number<int> 版本号,在没有第三个参数时可省略 //options:array用于创建objectStore,但只有数据库新建和版本变更的时候才会被调用,可省略 //它的格式如下: /*[{ name: string,//store名称,必填 options: object, //store配置选项,选填 index: {//设置索引,选填,目前仅支持配置一个索引 name: string, //索引名称,自定义(必填) fields: string/array<string>, //索引关联字段名,有多个时必须使用数组 options: object //索引的配置选项,选填 } },{ //... },...] */ open ( dbName , version , options = [ ] ) { return new Promise ( ( resolve , reject ) => { const indexedDB = window . indexedDB ||

IndexedDB not working in Firefox 29, but in Chrome

主宰稳场 提交于 2019-12-14 03:25:21
问题 I have a problem I have developed 50% of the code on Chrome IndexedDB using your console. However to test this code on Firefox I've noticed that does not work. The asynchronous functions are not calling this JavaScript Firefox is included on a HTML: <script src="./js/bdLocal.js"></script> bdLocal.js: var db; function openDB() { console.log("openDB ") ; var request = indexedDB.open("dblocal",1); //db = request.result; request.onerror = function(event) { console.log("Database error: " + event