Reputation: 16120
I am working on an Cordova application (for Android and iPhone) which requires to store offline actions and then sync those actions to server when internet becomes available. Actually I am new to Cordova (PhoneGap). I am using JQuery and AngularJS for performing other actions. Now my question is which would be the best Database choice in my case?
I know about LocalStorage but that will not meet my needs. Second one is WebSQL. I have seen its specification page. They are no longer maintaining this framework. IndexedDB I guess is only for Windows phone and Blackberry phones. There may be other big ones that I don't know. So I need your suggestions for possible options.
Upvotes: 1
Views: 1102
Reputation: 8940
I have two database for you. First one is I'm using for almost over a year. Didn't face any issue. Brodysoft SQL wrapper plugin It's use is just like web sql.
function onDeviceReady() {
var db = window.sqlitePlugin.openDatabase({name: "my.db"});
// ...
}
I didn't use the second one but saw the reference in SO. Read that it's very efficient. HTML5SQL
$.get('Setup-Tables.SQL',function(sqlStatements){
html5sql.process(
//This is the text data from the SQL file you retrieved
sqlStatements,
function(){
// After all statements are processed this function
// will be called.
},
function(error){
// Handle any errors here
}
);
});
Between this two choice has to be yours.
Upvotes: 3
Reputation: 353
I can suggest to use MongoDB. MongoDB is a document database that provides high performance, high availability, and easy scalability. A database holds a set of collections. A collection holds a set of documents. A document is a set of key-value pairs (JSON object).
Upvotes: 0