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
Highlighted
Developer
Posts: 38
Registered: ‎12-06-2011
My Device: Playbook 64GB, Curve 9360, BB Z10 LE
My Carrier: Koodo
Accepted Solution

Creating .db file in Cascades Application

Hi,

 

I am wondering how to create the initial .db file in order to use SQL databases in my application. I have taken a look at the quotes examples, and while useful, it does not work without the quotes.db file that already exists in the project. I tried deleting it but that breaks the app. Opening the file shows some cryptic content that I am unable to read.

 

Thanks

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Creating .db file in Cascades Application

If you can't or don't want to use the various DDL statements in your code to create your tables (and I haven't done Cascades DB stuff yet so I'm not familiar with how you would), you could just create the database files by hand.

 

This would involve downloading the command line shell utility (usually called sqlite3) and invoking it, to execute the commands by hand.

 

For example:

c:\> sqlite3 myfile.db
SQLite version 3.6.17
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table items (id integer primary key, name text);
sqlite> .schema
CREATE TABLE items (id integer primary key, name text);
sqlite> .quit

Then you could bundle myfile.db into your app as the starting database.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!