Does Puppeteer have sqlite? - sqlite

We're trying to create integration tests for our cordova app and puppeteer seems to be a good way to launch the ui.
But since we're using the sqlite database, it's very important for us that puppeteer also supports that option.
Does anyone know whether puppeteer has an integrated sqlite database? I do know it has localStorage.

Puppeteer is just a driver for the chrome headless. It doesn't support sqlite, You can use indexDB. Otherwise since it's all nodejs, you can simply store everything on sqlite using the sqlite3 driver.
Some helpful functions for accomplishing your target will be the exposeFunction function.

Related

SQLite support in Dart command-line application?

I need to manage (SELECT, INSERT, UPDATE, etc.) a simple SQLite database through Dart code, but all the SQLite connector libraries I could find are very outdated. I've searched for a solution and haven't seen anything compatible with Dart 2. Can anyone think of an alternative way to do this?
Note: The application and database will eventually be migrated server-side
with Azure.
Note: I am fairly new to working with SQL and RDBMS.
Thanks!
The sqlite package should provide what your need. It is pretty up-to-date including null-safety and recently updated.

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.

Monaca implementation of SQLite - Native via Cordova or Deprecated Web SQL?

So basically like the title says, does Monaca implement local storage database as SQLite using the native implementation via Cordova's sqlite plugin or does it rely on the deprecated use of Web SQL standard?
The Monaca docs here:
http://docs.monaca.mobi/cur/en/sampleapp/tips/storage/#creating-a-database-sqlite
Show that it is SQLite using the deprecated Web SQL standard: window.openDatabase
I would assume Monaca would actually be using Cordova implementation of native SQLite via the plugin but I cannot find it in the plugin manager nor do the docs support the implementation syntax of: window.sqlitePlugin.openDatabase
Either way, what would be the best practice use of SQLite in an app? My fear is to use what is documented (I think deprecated) and then next version have to recode everything when the Cordova plugin implements SQLite in native already.
Thanks!
XPost from here: https://community.onsen.io/topic/216/monaca-implementation-of-sqlite-native-via-cordova-or-deprecated-web-sql/2
#munsterlander this is a very good question! I actually didn’t know that Web SQL was deprecated. At the moment, Monaca includes just Web SQL plugin but the native Cordova plugin can be imported with a developer or higher plan and should work without any issue.
We will discuss about integrating the new plugin in Monaca but I cannot say when it will happen.
I don’t think you will have any issue with Web SQL but, of course, it’s better to use the native plugin.

PhoneGap, SQLite and full-text search

We are trying to scope out a project that has a relatively sophisticated search function. For instance it needs to search variations of words -- with "legal" and "legally" treated the same.
I believe the SQLite full-text extensions (FTS3, FTS4) will do everything we need, but I don't know if that's an option. Has anyone successfully used SQLite with FTS3 or FTS4 in a PhoneGap application?
If not, does anyone know of any robust alternatives that will work in PhoneGap?
The default sqlite build in iOS does not support FTS. You have compile your own version with support for FTS3/FTS4 and include it in your project. Then, in PhoneGap, use an SQLite plugin and you have a SQLite DB with FTS.

Resources