Manually tweak IndexedDB document - google-chrome-app

I am writing a Chrome Packaged App that uses the IndexedDB for data storage. Chrome allows me to view the contents of the database, but I can't find any way to manually change the data. I need to update this data from time to time because, you know, I'm still writing the app. Any idea how to manually change the data in the database?

Any changes to the IndexedDB database have to be performed via the IndexedDB API. There are no utilities, data editors, query apps, loaders, importers, or any other kind of external utility, such as there is for MySQL, SQLite, Oracle, or any other such database.
Furthermore, it's not even theoretically possible to write such a utility, because an IndexedDB database is sandboxed inside a single app, and no other app can access it.
What I do is incorporate the needed update forms and commands (delete database, create database, count rows, etc.) as modules inside the app, perhaps accessible from a Maintenance or Admin menu item. Obviously, this is a lot of work, but there is no other way if you're using IndexedDB.
In addition, I have a "load database" menu item that loads it from JSON in an external file. I do that from time to time when I want the app to have some initial data, or test data. But, this is just an example of what I said in the first sentence, above.

HTML5 Storage Manager All in One folks promise they'll have indexedDB support soon.
They use some tricks to open extension window inside the same domain as debugged page, thus making indexedDb accessible.
Doesn't work successfully at the time of this writing, though.

Related

Updating Application data in a Qlik Sense Application though Extension

Is it possible to change the application data from a extension?
I was creating a visual extension(table) in which if I change the value of a cell I should be able to change the value in the application level (not in database level),How can I achieve this?
Changing the value in Qhypercube.[].qDataPages.qDataPages... is only changing the value in Extension level.
I think the problem here is data persistence, since Qlik Sense itself is not a data warehouse or a true "data store" in the traditional sense. When you load data from a database into an app and it goes through the app's load script, it's then cached to the underlying QVF file for the app. Updating the data would need to happen at either the source level (the database in this case), an intermediary store like a QVD, or "on the fly" via variables and chart scripting. Those first two options are persistent and that third one is not.
That's why if you look at other similar Qlik extensions that enable users to input data, they are "writeback" solutions, as they update the underlying database that the app is pulling from. You can find a few examples of those here, here, and here.
A few existing ones also take the approach of outputting to QVDs, which could be your best bet if you want to avoid updating a database. See this one as an example, as well as their implementation docs here.
You could probably achieve all of this with a combination of:
Getting the hypercube of your (updated) table (more info)
Create a session app (more info)
Write to a new or existing QVD (more info)
(Partial) reload the current app (more info)
This would all depend on the Update rights of the users of the app, though.

How to stop sqlite3 database being replaced when the app using it is updated?

I am currently developing a mobile application in Python that uses a sqlite3 database in order to save data. However, if I rebuild and redeploy the application to my mobile device, the existing sqlite3 .db file on the mobile device understandably gets replaced with a brand new one. Is there any way to prevent this replacement from happening? I only plan on using this app for personal use, so it's not that urgent an issue, it would really only be convenient. Any advice would be appreciated!
You probably need to replicate what Android Apps written in Java or Kotlin use.
That is they (typically via SQLiteOpenHelper which is described as A helper class to manage database creation and version management.), check to see if the file exists at the expected location/path.
if not then the database (empty bar sqlite_master and android_metadata) is created and the onCreate method is invoked, allowing the user defined components (tables, indexes, views, triggers to be created).
if so then the database is instead opened.
This is a simplfied, overview, as it undertakes other things such as checking the user_version against a coded version, catering for onUpgrade or the rarely used onDowngrade methods to be utilised.
As such you probably just need to have similar logic to detect if the file itself exists (this as simple as this would be prone to failure should the file, for some reason, not be an actual SQLite file).

Local, file-based database for an Electron application

We are working on an application that will be offered both as a web-based and as a cross-platform desktop solution by means of Electron.
Due to customer requirements, the desktop client cannot make use of "the cloud" to store data; all data should be stored in the local machine or, even better, the user should have the option to keep the database/data file on an external HDD so that another user on the same local network can use the same data file.
We've been looking at NeDB, PouchDB, etc, but all these use either Web SQL or IndexedDB on the browser itself to store the data.
NeDB can theoretically use the file system but that seems only possible for Node Webkit apps.
Another option is of course MongoDB, but it requires setting up a site on a web server. Seeing as how our users will set that up in on their own machines, that will work for one user only but would make it very hard for them to share the data (note: assume users with little technical know-how).
Is there a way to force NeDB to persist data in a file instead of the in-browser database?
Alternatively, does any one know of a file-based, compact database that plays well with electron/node?
We'd preferably like to use a NoSQL database, but options of file-based SQL databases will be considered as well.
I have some experience with NeDB in an Electron app and I can say it will definitely work on the filesystem.
How are you initializing NeDB (or whatever your database choice is)? Also, are you initializing it in the main or renderer process? If you can share that, I think we could trace the issue to a configuration issue.
This is how you start NeDB with a persistent data-store that saves to disk.
var Datastore = require('nedb')
, db = new Datastore({ filename: 'path/to/datafile', autoload: true });
I think MongoDB is going to be overkill for an Electron app (it's meant to be really a high performance, distributed database running in the cloud).
Another option you could consider is LevelDB (a key/value store that can persist to the filesystem) which is popular in the node community. (EDIT 4/17/17 IndexedDB uses LevelDB underneath the hood, so if you go that route, may as well just use that)
One aspect I would definitely evaluate carefully is: How difficult is this database going to be to package and distribute? How do I integrate it into my build system? Level and NeDB can be included simply via npm install and any native code compiling is handled seamlessly with node-gyp, which is as simple as it gets. However, bundling Mongo, for example, will require some work to get a working build for each different platform.

Package webdatabase in phonegap

Phonegap storage documentation speaks only about how data can be added to the app via code. I want to push a compiled database (say Directory of phone numbers) to the PhoneGap app. Is it possible?
AFAIK, you cannot push a compiled DB.
What you can do is to include the content of this database as a SQL file in your app, load it in ajax and use phonegap executeSql function to populate the DB.
This would of course only need to run once.
You could also just export the DB to a text format (CSV or JSON), and depending on the size and how/what you are querying, either load it in memory or add it to the localStorage (or SQL) in the target PhoneGap framework...
The only other way I see this happening is by using CouchDB - a NOSQL DB that has support for Android/iOS/PhoneGap - which can also synchronize a local DB with a remote one (all magic!) thus allowing your remote phone numbers to change and still to be updated (incremental) at your client.
Hope this helps

How can I make permanent the custom data I have manually put into my core data database?

Ok, I am admittedly pretty new to core data, and am still not quite as knowledgeable as I would like to be. I am doing some pretty basic data retrieval from the database using values that I went in and added myself (using the sqlite editor Base).
I got everything working in my simulator, and I thought that life was just dandy but I went in and installed the app on my 2g iPod touch, and when my pickerview went to go get data...there wasn't anything there! I guess it's not terribly surprising, but I was thinking that the app build would just copy the db that I had setup??
What is going on? What do I need to do to make it so that the pre-loaded data is available for any and all downloaders of my app?
Thanks!
The core data persistent store won't get automatically added to your app. You will need to add this file to your project so that it becomes part of the app bundle when you build the app. You can see what will happen in xcode after you've added this file under your target settings.
Additionally apple discourages modification of the SQLite data store directly outside of core data. You may be better off just using SQLite in that case. If you feel you really need core data, you may want to make a default SQLite database that is part of your app. The first time the app is run (or the data is reset) you can then import that data into your user's custom core data persistent store. See this portion of apple's documentation on how to import an existing SQLite database into core data. This allows you to have default data but gives you the flexibility of being able to reset the database easily.