admin管理员组

文章数量:1402935

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. I found a script, but it creates a WebSQL database in the browser. I want to query the 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);
    }
}

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. I found a script, but it creates a WebSQL database in the browser. I want to query the 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);
    }
}
Share Improve this question asked Oct 15, 2012 at 19:59 sehummelsehummel 5,56825 gold badges92 silver badges141 bronze badges 3
  • so you do or dont want to use WebSQL? – prodigitalson Commented Oct 15, 2012 at 20:05
  • WebSQL has been deprecated. I want to use something else. Is Indexed DB my only choice? I want to work with the SQLite file. – sehummel Commented Oct 15, 2012 at 20:06
  • 2 as you stated WebSQL, the implementation of SQLite in Web Browser, is deprecated, so if you really need to use that format i can only suggest to use this SQL.js – user757095 Commented Oct 15, 2012 at 20:18
Add a ment  | 

2 Answers 2

Reset to default 2

Yes, Its possible. Try the following links

  • http://benpoole./weblog/201106222227
  • https://gist.github./1041277
  • https://www.tutorialspoint./html5/html5_web_sql.htm
  • https://developer.apple./library/archive/documentation/iPhone/Conceptual/SafariJSDatabaseGuide/UsingtheJavascriptDatabase/UsingtheJavascriptDatabase.html

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. All your links are providing tutorial on Web DB which the question clearly highlights.

I think you should research SQL.JS on Github to get a solution to what you want. It is somewhat dependent on Node.js but you will achieve your goal just fine.

本文标签: