DataStore vs SQLite - Sencha Touch - sqlite

A rookie question. Can any one explain when it is better to go with SQLite storage in sencha touch and when to go with use data stores.
regards,

I don't think they are mutually exclusive.
Sencha Touch stores come into their own when you have any kind of data that needs displaying in the viewport (and that data might change)
Sencha have a sql proxy that will work on these stores with a browser's websql implementation or a native app's sqlite implementation (with the aid of a cordova/phonegap plugin)
The main reason why you'd use SQLite on a native app is to circumvent the 5mb localstorage limit. You can't get around this limit for webapps though.

Related

Ionic 2 storage module clarification

There is a lot of confusion when it comes to ionic 2 storage. There was a lot of changes in the new ionic version as Storage was moved to #ionic/strage . I am new to Ionic so some of the things are confusing for me. I have web-development background. From the documentation,
A simple key-value Storage module for Ionic apps based on LocalForage,
with out-of-the-box support for SQLite. This utility makes it easy to
use the best storage engine available without having to interact with
it directly. Currently the ordering is SQLite, IndexedDB, WebSQL, and
LocalStorage.
Installation
npm install #ionic/storage
If you'd like to use SQLite as a storage engine, install a SQLite plugin (only works while running in a simulator or on device):
cordova plugin add cordova-sqlite-storage --save
What I would like to know is, what happens when I run this in browser ? Where does it store the data? What would happen if I dont use cordova-sqlite-storage ? Where does it store the data then?
Ionic also supports SQLite plugin natively to store data in SQLite database .
import { SQLite } from 'ionic-native'
How is it different from Storage other than the fact that there is a fallback to IndexedDB, WebSQL, and LocalStorage ?
I hope my thoughts are in the right direction. A clear answer on how these modules work would be really helpful.
Ionic Storage is the first module written with proper web fallback in mind.
One near-term goal we have with Ionic is enabling devs to build 99% of their app in the browser. It's a much faster workflow. This means support for native plugins that have web fallbacks, as well as better mocking for ones that don't. - Max Lynch on Twitter
By default when running, #ionic/storage will prioritize the storage methods this way:
When running in a native app context, Storage will prioritize using
SQLite, as it's one of the most stable and widely used file-based
databases, and avoids some of the pitfalls of things like localstorage
and IndexedDB, such as the OS deciding to clear out such data in low
disk-space situations.
When running in the web or as a Progressive Web App, Storage will attempt to use IndexedDB, WebSQL, and localstorage, in that order.
- Official Documentation
So when your app is running in the browser (or on a device without the SQLite plugin) it will detect that SQLite is not available and will use IndexedDB/WebSQL instead.
How is it different from Storage other than the fact that there is a fallback to IndexedDB, WebSQL, and LocalStorage?
The SQLite plugin gives you low-level access to an SQLite database, which means you have to care about creating/updating your schemas, and write queries.
#ionic/storage is a wrapper which abstract away the differences of LocalForge and SQLite and provide a simple, unified API to store key/value pairs.
Also it takes care of serializing/deserializing of your objects.
From my understanding of the Ionic 2 RC Storage module, when you are running in the browser you are now only able to store key-value pairs (LocalStorage). You are currently not able to store anything more than that, so you should check out other options like PouchDB and LocalForage if you need full SQL support. This definitely isn't ideal for progressive web apps.

No storage limits using PouchDB + Cordova-sqlite-storage?

I've been looking into the Phonegap and PouchDB docs for days but I don't seem to get a clear answer.
Is it correct that when I add the Cordova plugin Cordova-sqlite-storage and use PouchDB using the PouchDB API, I'll have unlimited storage in my iOS webview?
I'm actually confused since I thought PouchDB was based on CouchDB (which seems like NoSQL). SQLite is using SQL queries for data storage.
Thanks!
Yes, you don't have traditional storage limits when using cordova-sqlite-storage. I've worked on an app that's in the App Store and Google Play today that uses >100Mb of data in SQLite. Cordova documentation backs this up.
PouchDB has a SQLite adapter which you might be able to use but I have no direct experience here and the documentation notes you should only use it with SQLite unless you really need >50Mb storage as there can be performance issues.
LokiJS with persistence might also be an option for you.

Security for database SQLite of apps

I'm beginner in eclipse and android apps. what can I do for security of database? prevent hack or steel my database of my app. And where is database of apps in mobiles with android OS?
You can't. It is pretty trivial to get it, no matter what you do. If you want to keep your data safer, you can drop the local database, and make a web service where you get your data from. Then you will have to make some restrictions, so people will not rip your data fast. This is known as anti-farming and you can see more at https://www.owasp.org/index.php/REST_Security_Cheat_Sheet#Anti-farming
But this will only slow people down, and as the article says, large resource adversaries will still be able to get whatever they want.
What to do: don't focus on it, build a awesome app, so no other will reach your user level/profit.
Take a look at https://www.zetetic.net/sqlcipher/sqlcipher-for-android/. It is possible to create a encrypted database with that library. You should only think about where to place the key of it. One possible solution is that user has to enter the password via login dialog for example.
The database and app specific data is located at /android /data/package of your app folder.

Offline data with replication/synchronization for Xamarin app on IPhone?

What is the safest way to store offline data that can be synchronized with a remote Sql Server if we build an app using Xamarin on IPhone?
We are currently investigating SiaqoDB and Sqlite.
SiaqoDB does have samples for this, however, the database itself seems somewhat unknown and the community around it is small.
Sqlite has a huge userbase but there don't seem to be any out of the box sync support for this.
Are there other alternatives?
How does SiaqoDB compare to Sqlite here?
I dont know SiaqoDB but i used SQLite on a Xamarin project a while ago.. If you use the SQLite component from Krueger systems Krueger you will have a working database, without synchronization. You could also go for Zumero SQLite, which includes synchronization to their own server, but i havenĀ“t tried them so i cant compare the two.

Is it possible to save data to sqlite using flash player plugin rather then AIR?

We have a flash web app. we thought to use local storage to enhance performance and responsiveness. LSO falls short to sqlite. AIR is too far on the roadmap for us productwise, therefore wanted to ask if the flash player had evolved to include sqlite local storage from the browser like HTML5 has access to...
cheers.
If you are willing to go through JS I think you are on the right track.
See: Javascript + HTML5 localstorage

Resources