Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
Posts: 14
Registered: ‎07-09-2011
My Device: PlayBook 16GB
My Carrier: N/A

Migrate WebWorks App to Cascades

Hi, I have a PlayBook/BB10 WebWorks app currently in App World.  It uses a local sqlite database managed through the html5 sqlite database interface.  I'm interested in rewriting the app as native using Cascades but I need to maintain the existing database (during an upgrade) because that is where user data is stored. Is that database file stored in the data/ directory of the application and is it possible to open it from a native app?  Has anyone tried this?

 

 

Thanks!

 

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Migrate WebWorks App to Cascades

Browse your App's folders on Palybook and find out where your DB is (when the app in dev mode). Copy it to new project (Native) and play with it from within Native app you are building. I am pretty sure you won't have any issues with 'compatibility' on sqlite level.

Contributor
Posts: 14
Registered: ‎07-09-2011
My Device: PlayBook 16GB
My Carrier: N/A

Re: Migrate WebWorks App to Cascades

You are correct, I believe this is possible.  The web database is stored in /accounts/1000/appdata/<app-name-dir>/data/webviews/database.  In this directory is a sqlite database file called Databases.db.  That database has two tables, Databases and Origins.  The "Databases" table is the most interesting since it has all the information needed to find the location of the database(s) created by the Webworks app.

 

$ sqlite3 Databases.db
SQLite version 3.7.14.1 2012-10-26 13:34:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
Databases Origins

sqlite> select origin, name, displayName, path from Databases;
local__0|gasdb|Gas Database|0000000000000001.db

sqlite> .quit

 

In this cases, origin => 'local__0', that's the sub-directory where the database is located, and path => '0000000000000001.db', that's the database file.

 

$ cd local__0
$ ls
0000000000000001.db
$ sqlite3 0000000000000001.db
SQLite version 3.7.14.1 2012-10-26 13:34:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
__WebKitDatabaseInfoTable__ maintenance
gas reminder
maint_type vehicle

 

And there is my app's database!

 

Since the data directory is supposed to be conserved between upgrades, I don't see any reason why these database files couldn't be accessed by a native upgrade.  I haven't tested that yet, but so far everything I've discovered has me optimistic that this is very daoable.

 

I just wanted to share what I found, hopefully this helps anyone else who is thinking of migrating their Webworks app to Cascades.