Phonegap : What happens to my sqlite database? - sqlite

I am using phonegap for my mobile application. I am creating a database from the application.
Everything is working fine and as expected.
But what happens to my database when I uninstall my application?
The database is also removed or do I have to remove the database manually?
I have created a different app to erase the database, but looking at the console.log()s it is seen that database also gets erased along with the application.
Is it true? or am I doing something wrong?

In my experience, when you deinstall the App like the user would by deleting the App on the Telephone, the Data of Database also gets deleted.
When I re-install the App for Developing, let`s say with
./adb install <packagename>
or from XCode, the Data does not get deleted.

Related

Firebase Console delete part of Project

I am using firebase with my android and iOS app.
My android app got removed from play store once (had to be 18+, it was 16+, don't know why they deleted it, its a joke app and no nudity or brutality is shown :D). Now many users have the old version which will receive no updates anymore. We managed to get many users to change to the new app (uploaded with different package name, everything else is the same)
I want to remove the old version from firebase. It uses old code and will not receive updates.
QUESTION
If I remove the old app from the project, will users still be able to connect to my firebase?
My hope is that they won't be able and will remove the old app (and maybe look up the new one as a reaction)
Will it make anything unexpected? I did not find anything about it despite that I lose the analytics.
As I cannot update the old app there is probably no other way to remove it.
To connect to the Realtime Database from an Android or iOS app, all the app needs to know if the URL of that Realtime Database. So no matter if there's an app registration in the Firebase project or not, if the code has the right URL it can connect.

Cannot fill azure db with data. WebPage is connected to database but don't want to create tables

I created website using asp.net MVC with Entity Framework Code First. It worked before on Windows Azure, the site was available publicly.
For some reason, I deleted database that was used to store data of my webpage. I created new one, similar to previous one.
I properly connected my site to database (in solution I clicked "Publish", in "Settings" there is place to type data about database, in "Destination Connection String" window I typed all needed data and clicked "Test Connection" - everything seems to be fine)
I published my site, the site works correctly, but when I go to page that gets data from database is see this error:
Invalid object name 'dbo.AspNetUsers'.
In Visual Studio in "SQL Server Explorer" I can see what is in my database. In fact, there is nothing inside (there is one table: "__MigrationHistory" and as I suspect this is created by default).
How can I generate all those tables again? It should generate database structure automatically.
PS: Accidentally I deleted "migations" from my project, do you think this is the cause?
This is not my projects blame, it works OK on localhost on my computer, when I delete localDB, it generates new one without any problem.
Yes, you need migrations. But you can always re-create them (well, if you removed them all it will be initial migration containing all of your previous migrations).
To quick fix you can backup and restore you database on the server. And if you need to re-create migrations do the following:
Backup all your data
Delete the entire database (local and remote), delete all migrations from code.
Create databases (local and remote one).
Run "add-migration Initial" command from PM console
Run "update-database" from PM console.
Upload your code to the server again. If database is empty, new initial migration should be automatically applied.

How to persist SQLite database on Icenium?

I try to build a database on Icenium with SQLite and the db does not persist - why? I think the structure of the database is not built on a physical level. Someone you ever had this problem?
I was able to use SQLite with Icenium on my project successfully. As I see, there is also an example that you can look up:
https://github.com/Icenium/sample-sqlite.git
You might also want to take a look at this post: Creating a Database from a SQL Dump, for using prepopulated SQLite database.
From my experience with Telerik AppBuilder (formerly called Icenium), each time you Run the project in a simulator, the simulator starts from scratch and it keeps no record of what happened in previous runs.
The solution I would use to 'persist' the database on a session basis and test your code is as below.
You must keep the simulator open (so don't close it) to keep database intact
and just press Reload button in simulator window to see how an existing database
would run on a real device every time the app is re-started on a real device,
because within a single Run of the simulator it remembers everything.
Even if you want to make changes to your code or html, leave the simulator open and make your code changes (and Save), and then click on Refresh button in simulator window to bring in your recent code changes without losing the database and its data. If you follow this approach you can easily test how a database would behave on real device where a database is naturally persisted.
So think, in terms of 'simulator session' when developing hybrid apps using Telerik AppBuilder.

how to use pre-populated database with tidesdk/titanium desktop

I'm in need of some help in developing a desktop application with a pre-populated database. I have tried numerous ways to get this working including those mentioned on both Tidesdk's API here http://tidesdk.multipart.net/docs/user-dev/generated/#!/api/Ti.Database.DB and at Titanium Desktops old API here http://developer.appcelerator.com/apidoc/desktop/latest/Titanium.Database-module.
While the later (using Titanium not Ti) works in creating a database in the apps directory it does not install my pre-populated sqlite database which is located in the resources file of my app.
A couple of my attempts located below
var db = Titanium.Database.openFile('test_db.sqlite', 'test_db');
var db = Titanium.Database.openFile(Ti.Filesystem.getFile(
Ti.Filesystem.getApplicationDataDirectory(), 'test_db.sqlite'));
var db = Ti.Database.open('test_db');
As stated most of these manage to create a database with the name given but when trying to run something as simple as a db.execute(SELECT) of something I know would exist in my pre-populated db I receive an error stating
Exception executing: SELECT name, id FROM people ORDER BY name COLLATE NOCASE, Error was: SQL Statement invalid or database missing
I have searched high and low for something to answer this but everyone continues to refer to the aforementioned API's or to the Mobile API's Ti.database.install() which does not work either.
Is it possible with titanium desktop to use a pre-populated sqlite database or do I have to populate it after I create it? If so any direction would be helpful (where to place the .sqlite file in the app and what functions to call).
I am currently using Titanium Studio with a titanium desktop osx SDK of 1.2.0.RC4 as requested by tidesdk.org until they have released there open source sdk.
Thanks in advance
This is possible, I just used this feature in a recent desktop app, deployed it successfully to Windows and Mac.
In my experience, sometimes your database file can be corrupted, for example if you use the Titanium.Database.install command, and it cant find the file to preload from (maybe the first time you specified the path wrong for instance), it will create the file itself, any subsequent install commands will not work because it already thinks this database has been installed.
Have you tried clearing out the application data? This is where titanium installs the database. For Mac this is in your /User/Library/Application Support/APPNAME directory. Their is a directory for databases, delete this and try again.
Also, this answer on Titanium Q&A may help, it talks about the process with the Mobile SDK but the Database stuff is the same.
Hope this helps!

Creating a database in the blackberry device when the app is installed

I want to create a database on my blackberry device when my app is installed. I did not find any event (e.g. onInstalled) so that i can create my databse on this event when the app is installed.
Apparently there is a method DatabaseFactory.exists() which i can use to check if the database exists or not. But i do not want to check for this every time. I want to create the database when my app is installed and when the app is un-installed then the database should also get deleted.
Thanks
As far as I know RIM API SDK does not provide mechanism to catch install/uninstall events.
And even the database is once created it can be deleted/damaged via the filesystem. For instance user deletes database files from the media-card or from the device memory. Just because user does not know what these files contain and assumes these as temporary or something else.
It is a good approach to check the database presence before starting work with it. Otherwise user may get blank white screen with text "Exception 1234" and some additional text, or may get a popup with strange message, like "Error: FileNotFoundException...".
See the SQLiteDemo in the blackberry samples demo then you can get solution.

Resources