IndexedDB 或 SQLite,用于在 Intel XDK 上开发的内部数据库

IndexedDB or SQLite for internal database developing on Intel XDK

我已经有了将通过 Intel XDK 转换为移动应用程序的 Web 应用程序,但我不知道关于数据库选择什么选项,我想为此了解更多有关 SQLite 的信息,但我在一些文章中看到 SQLite 已被弃用对于这个目标,我错了吗?

另一方面是我今天刚读到的 IndexedDB

我找不到关于这个疑问的新信息,请问您能给我一些建议吗?

我建议使用 IndexedDB 而不是 SQLite。我发现很难为 SQLite 找到合适的插件,它仍然受支持并且有一些有用的文档。

我找到了一个优秀的插件,它的文档也很优秀,作者对 IndexedDB 给予了支持。它被称为Dexie and is described as a A Minimalistic Wrapper for IndexedDB. It also has a Github page which is located here

例子

一些例子取自他们的网站。

数据库连接:

/*
|----------------------------|
| Make a database connection |
|----------------------------|
*/

var db = new Dexie('MyDatabase');

// Define a schema
db.version(1).stores({
    friends: 'name, age'
});


// Open the database
db.open().catch(function(error) {
    alert('Uh oh : ' + error);
});

正在执行查询:

/*
|-----------------------|
| Then run some queries |
|-----------------------|
*/

// Find some old friends
db.friends
    .where('age')
    .above(75)
    .each (function (friend) {
        console.log (friend.name);
    });

// or make a new one
db.friends.add({
    name: 'Camilla',
    age: 25
});