How to use joins in HTML5 with indexed Db?

I want to join two tables with an indexed HTML5 index. I found sample lots to add, update, delete, and print the record, but I can not find samples to join multiple tables.

  • Sample URL: * http://users.telenet.be/kristofdegrave/*
+5
source share
5 answers

I was thinking about the same issue when I looked at these technologies. Did not check your specific example, but here is an example from Mozilla on how to make a connection if you need it:

https://hacks.mozilla.org/2010/06/comparing-indexeddb-and-webdatabase/

SQL, , , JavaScript .

+5

, .

ydn-db, SELECT * FROM Supplier, Part WHERE Supplier.CITY = Part.CITY

var iter_supplier = new ydn.db.IndexValueIterator('Supplier', 'CITY');
var iter_part = new ydn.db.IndexValueIterator('Part', 'CITY');
var req = db.scan(function(keys, values) {
  var SID = keys[0];
  var PID = keys[1];
  console.log(SID, PID);
  if (!SID || !PID) {
    return []; // done
  }
  var cmp = ydn.db.cmp(SID, PID); // compare keys
  if (cmp == 0) {
    console.log(values[0], values[1]);
    return [true, true]; // advance both
  } else if (cmp == 1) {
    return [undefined, SID]; // jump PID cursor to match SID
  } else {
    return [PID, undefined]; // jump SID cursor to match PID
  }
}, [iter_supplier, iter_part]);

.

+2

, IndexedDB API JOIN. , , , . RBAR, .

+1

IndexedDB , , .

In the case where you show, the data from the code file is connected to the real data. The case to solve this problem without combining is simply to extract your code table into memory (usually this data never changes) and make a connection in the code.

+1
source

Instead of trying to join, redesign how you store data so that a connection is not required. You do not need to follow the same normalization restrictions as SQL when you use the approach without sql. No-sql supports data backup when it comes up.

+1
source

All Articles