简体   繁体   English

是否可以使用Javascript打开Sqlite数据库而不使用除HTML5之外的任何东西?

[英]Is it possible to open an Sqlite database with Javascript and not using anything but HTML5?

I'm trying to create an application that works on any mobile device, but doesn't require internet. 我正在尝试创建一个适用于任何移动设备的应用程序,但不需要互联网。 I want to have an Sqlite database that I can query. 我想要一个可以查询的Sqlite数据库。 I found a script, but it creates a WebSQL database in the browser. 我找到了一个脚本,但它在浏览器中创建了一个WebSQL数据库。 I want to query the flatfile. 我想查询flatfile。 Is that even possible? 这甚至可能吗?

Here is my code: 这是我的代码:

function createDatabase() {
    try{
        if (window.openDatabase) {
            var db;
            var shortName = 'configurator.sqlite';
            var version = '1.0';
            var displayName = 'configurator';
            var maxSize = 65335;

            db = openDatabase(shortName, version, displayName, maxSize);
        } else {
            console.log('failure');
        }
    } catch(e) {
        alert(e);
    }
}

The question is asking for someone who can provide a tutorial to query a FlatFile DB and not a web db embedded within the browser. 问题是要求可以提供教程来查询FlatFile DB的人,而不是浏览器中嵌入的Web数据库。 All your links are providing tutorial on Web DB which the question clearly highlights. 您的所有链接都提供Web DB的教程,问题清楚地突出显示。

I think you should research SQL.JS on Github to get a solution to what you want. 我认为你应该在Github上研究SQL.JS来获得你想要的解决方案。 It is somewhat dependent on Node.js but you will achieve your goal just fine. 它在某种程度上依赖于Node.js但你会很好地实现你的目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM