11-08-2010 09:39 AM
Does playbook OS have a built-in database? Like SQLite? How about APIs?
Thanks
Solved! Go to Solution.
11-08-2010 09:57 AM
Not at the OS level, but at the Flash/AIR level. Lots of documentation and examples on SQLite, but here is the adobe documentation on it.
http://help.adobe.com/en_US/FlashPlatform/referenc
11-08-2010 10:21 AM
Thanks!
01-14-2011 05:53 PM
Hi Guys,
i am pretty new with the usge of database. I would like to dev a simple note app using database has refrence id for each notes.
do you have some example or tuto step by step?
01-14-2011 10:07 PM
Dani78112 wrote:
Hi Guys,
i am pretty new with the usge of database. I would like to dev a simple note app using database has refrence id for each notes.
do you have some example or tuto step by step?
Hey - I am working on notes app too ;-) welcome to the club...
here is sample AS3 code to get you started.
import flash.filesystem.File;
import flash.data.*;
var myDB:File = File.applicationStorageDirectory.resolvePath("myda tabase.db");
var sqlConn:SQLConnection = new SQLConnection();
var sqlStatement:SQLStatement = new SQLStatement();
sqlConn.open(myDB);
sqlStatement.sqlConnection = sqlConn;
sqlStatement.text = "SELECT * FROM table1";
sqlStatement.execute();
var result:Array = sqlStatement.getResult().data;
The "result"variable is an array with the result of the query where each array member is an object where value of a column is a property with the name of the column.
You can also set itemClass property on the sqlStatement to particular object class and the array objects will be returned of the type of the object you specify in the itemClass as long as the DB column names match the object properties. Its pretty exciting stuff ;-)
Hope this gets you going.
01-15-2011 05:04 AM
hello, thanks for this, I'll try it soon.
![]()
01-15-2011 08:57 AM
p3pp3r wrote:
Dani78112 wrote:Hi Guys,
i am pretty new with the usge of database. I would like to dev a simple note app using database has refrence id for each notes.
do you have some example or tuto step by step?
Hey - I am working on notes app too ;-) welcome to the club...
here is sample AS3 code to get you started.
import flash.filesystem.File; import flash.data.*; var myDB:File = File.applicationStorageDirectory.resolvePath("mydatabase.db"); var sqlConn:SQLConnection = new SQLConnection(); var sqlStatement:SQLStatement = new SQLStatement(); sqlConn.open(myDB); sqlStatement.sqlConnection = sqlConn; sqlStatement.text = "SELECT * FROM table1"; sqlStatement.execute(); var result:Array = sqlStatement.getResult().data; The "result"variable is an array with the result of the query where each array member is an object where value of a column is a property with the name of the column.
You can also set itemClass property on the sqlStatement to particular object class and the array objects will be returned of the type of the object you specify in the itemClass as long as the DB column names match the object properties. Its pretty exciting stuff ;-)
Hope this gets you going.
Hi p3pp3r,
I don't need this, but would like to know more. Would the DB be a CSV file?
01-15-2011 10:57 AM - edited 01-15-2011 10:58 AM
amycanada wrote:
I don't need this, but would like to know more. Would the DB be a CSV file?
It's a SQLite database, not a CSV text file. See the docs for flash.data or (linked to from that page) SQL support in local databases.
For those new to any of this, you'll be most efficient if you start off with SharedObject. It has limitations, but for your first attempts it will get you farther faster. It's also probably the best for any simple data, especially app settings/preferences.
Migrate from that to flash.filesystem stuff to learn how to work with local files. You can layer XML on top of that if you're familiar with it, or other means of encoding (e.g. JSON). Using this with CSV is also a good option for many moderate needs involving tabular data.
Lastly, and only when it's really worth your while, move up to the database stuff. It can be very efficient, and flexible, and is the most powerful for "relational" information (multiple inter-related tables). It can also have significant disadvantages not the least of which is the learning curve. If you need its power then you may have little choice in the matter, but I'd suggest this is an area where you should learn to walk before you try to run.
(Edit: fixed bad link to sqlite.org.)
01-15-2011 10:59 AM
Sorry for the bad link to SQLite. The one I first included is an unused domain.
01-16-2011 05:59 PM
Hi Peter9477,
Thanks! I'm very familiar with MS SQL Server, but I didn't know there was anything similar that could be used with Flash...
That's good to know.