News for hackers. Stuff that matters.
Re:IndexedDB is completely broken in latest Safari by nanis on Tuesday June 15, 2021 @06:51AM (#27513439)
> That post has too many examples of hubris and delusion for me to bother quoting it here

Well, I could not help myself.

>> While versions of Safari, Chrome, and Opera support a technology called Web SQL Database, which uses SQL statements as string arguments passed to a JavaScript API, we think developer aesthetics are an important consideration, and that this is a particularly inelegant solution for client-side web applications.

>> We .. also spoke with Microsoft, who agree with us that IndexedDB is a good option for the web

OMG!! MS thought not doing what Apple and Google wanted was a good option. Earth shattering.

As for the code examples, both sets look horrible, but this and "_developer aesthetics_" don't go together. This is how they think their `JOIN` is "better" than SQL `JOIN`.

    candyEaters = [];
    function displayCandyEaters(event) {
      var display = document.getElementById("purchaseList");
      for (var i in candyEaters) {
        display.textContent += ", " + candyEaters[i].name + "bought " +
                               candyEaters[i].count + "pieces";
      }
    };

    var request = window.indexedDB.open("CandyDB",
                                        "My candy store database");
    request.onsuccess = function(event) {
      var db = event.result;
      var transaction = db.transaction(["kids", "candySales"]);
      transaction.oncomplete = displayCandyEaters;

      var kidCursor;
      var saleCursor;
      var salesLoaded = false;
      var count;

      var kidsStore = transaction.objectStore("kids");
      kidsStore.openCursor().onsuccess = function(event) {
        kidCursor = event.result;
        count = 0;
        attemptWalk();
      }
      var salesStore = transaction.objectStore("candySales");
      var kidIndex = salesStore.index("kidId");
      kidIndex.openObjectCursor().onsuccess = function(event) {
        saleCursor = event.result;
        salesLoaded = true;
        attemptWalk();
      }
      function attemptWalk() {
        if (!kidCursor || !salesLoaded)
          return;

        if (saleCursor && kidCursor.value.id == saleCursor.kidId) {
          count++;
          saleCursor.continue();
        }
        else {
          candyEaters.push({ name: kidCursor.value.name, count: count });
          kidCursor.continue();
        }
      }
    }
Re:IndexedDB is completely broken in latest Safari by brigandish on Tuesday June 15, 2021 @08:38AM (#27514388)
It's terrible, isn't it? Have these people ever used SQL? Doubtful, it they had then they might know the difference between joins and cursors!