How to determine it's a WebSQL or Sqlite database? - sqlite

Pardon if this sounds noob.
We are current working on a mobile application that utilizes the Cordova framework. We would need to store data on the device, and such had decided on to use a database system.
We understand that for db storage, Cordova supports the WebSQL API, but since currently W3C stopped the development on WebSQL, we would wish to use a native SQLite database.
However, we do have a database file that are created via the WebSQL API. I understand that WebSQL actually utilize SQLite underneath(correct me if i'm wrong), but would the file display the characteristic of a WebSQL database? such as the file size limitation on mobile device?

The file size limitation is implemented in the particular copy of the SQLite library that is used to access the database, not in the database file itself.
Please note that W3C's (lack of) endorsement does not necessarily influence whether Cordova continues to use WebSQL.

Related

Is it possible to use local SQLite db on web browsers

Is it possible to use local SQLite db on web browsers like Mozilla, chrome, IE and safari. I mean, can i use local SQLite db for web application. If No, please suggest the alternative local DB.
Well, you can use SQLite for the Web-Browsers using this sql.js
which says
sql.js is a port of SQLite to JavaScript, by compiling the SQLite C code with Emscripten. It uses a virtual database file stored in memory, and thus does’nt persist the changes made to the database. However, it allows you to import any existing sqlite file, and to export the created database as a javascript typed array.
However, there are certain more ways to store your data in your browsers' local database. You may use these:
Indexed DB - W3C Recommendation 08 January 2015
WebSQL - It is no longer in active maintenance and the Web Applications Working Group does not intend to maintain it further.
Although Safari does not yet support Indexed DB, but hopefully in near future it will be supported by all major browsers.
There are certain drawbacks in each of these databases
you can follow this link to get a detailed comparison -> (Link)
Try the following Add-on for Mozilla:
SQLite Manager

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.

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.

Which database is shipped with TideSDK?

I'm trying to use TideSDK to create a Accounting software for a client.
The software will mainly do CRUD operations.
I'm wondering which Database is shipped with TideSDK. Is it localStorage / SQLite?
Is there a way to bundle any other Database?
The reason I'm asking is, the software will store around 10 tables and each with approx 10K rows min (depends on user's plan).
What's the best way to take regular backup so we don't loose any data in case Database crashes?
TideSDK is shipped with SQLite Database. There is no limitation for the database size for the SQLite Database, as long as you have enough harddisk space you should be able to use and expand the database.
You can certainly bundle any other database with TideSDK application. Currently the natively supported database is SQLite.

Phonegap Pre-Populated SQLite DB with SQLite Plugin? Compatible with Phonegap 1.2?

I'm trying to include a SQLite database with a phonegap native application, I've seen a couple of methods that would work. However from looking at this recent post, it seems that these will pose a problem when submitting apps.
The guy who posted this and others have suggested the Phonegap SQLite plugin will allow me to include a pre-populated SQLite DB with my app.
Can anyone please confirm this and point out how exactly I achieve the pre-populated database? It doesn't seem to work with phonegap 1.2.
If it does allow me to create a pre-populated DB I'll switch to an earlier phonegap.
Why not use a standard SQLite DB ?
As for the prepopulated part, you need only add a check mechanism that finds out if the user is opening the app for the first time. If they are, you can load some INSERT SQLite queries into your DB and populate it. If the app is opened the second time, this does not happen.
To find out exactly what options you have at your fingertips, try this post below, I think it answers all your questions.
Phonegap Offline Database

Resources