Peter Elst

Flash Platform Consultant
  • Home
  • About me
  • Articles
  • Downloads
  • Contact me

Introduction to SQLite in Adobe AIR

7 04 2008

I just got back from joining the European on AIR tour in Amsterdam and Brussels and it rocked big time!

Two great events with hundreds of developers attending to learn all about the Adobe Integrated Runtime. For me it was an opportunity to deep dive in the SQLite database API and build a couple of interesting demo’s. Talked to so many people with fantastic ideas and eager to get started with AIR that I’m sure we’ll be seeing some amazing things happening in the coming months.

As promised here are the slides for my SQLite talk as well as the downloads for the various demo apps and flash.data.SQLConnection and flash.data.SQLStatement wrapper classes.

 
 SQLite in Adobe AIR slides



 
 SQLite Contact Manager

The “SQLite Contact Manager” is a simple AIR application that allows you to add, edit, delete and search contacts in a local SQLite database.

SQLite Contact Manager

Download source code

 
 SQLite wrapper classes

I’ve written some classes to easily work with SQLConnection and SQLStatement classes in Flex as MXML tags and hook them up using events.

<sql:SQLite id="contacts_db" file="contacts.db" open="allcontacts_query.execute()" />
<sql:Query id="allcontacts_query" connection="{contacts_db.connection}"
sql="SELECT * FROM contacts"
result="contacts_dg.dataProvider = allcontacts_query.data" />
<mx:DataGrid id="contacts_dg" left="0" right="0" top="0" bottom="0"/>

The code above assumes you already have a contacts table in contacts.db and some entries to get returned. The DataGrid component has its dataProvider property bound to the data that we get back from the allcontacts_query.

Any time this query gets executed the DataGrid component will update its data as needed. You can download the SQLite and Query classes below.

Download source code

 
 SQLite Editor

The “SQLite Editor” application allows you to easily run queries on a local SQLite database and uses SQLConnection.loadSchema() and introspection to list all tables in the database.

SQLite Editor

Download source code

 
 SQLite YouTube Database

The “SQLite YouTube Database” application allows you to load your favorite YouTube video’s in and store them as a binary data in a local SQLite database so you can view them when offline, share them with friends and extract FLV’s back out of.

SQLite YouTube Database

Download source code

« Scotch on AIR SQLite in Adobe AIR session video »



Actions

  • rss Comments rss
  • trackback Trackback

Informations

  • Date : 7 April 2008
  • Categories : AIR, Events
On FriendFeed, this post was liked by 0 people and commented on 0 times show
View this post on FriendFeed

Add a comment on FriendFeed




Logged in as [logout]

25 responses to “Introduction to SQLite in Adobe AIR”

7 04 2008
Bobby (22:01:31) :

Can you also share the presentation to download? maybe using Adobe share? Or as a pdf or keynote or something….

Thanks

7 04 2008
Paul Robertson (23:43:14) :

Looks like a great presentation and some nice demo apps.

I did want to point out that I think the 8th slide, “Storage Types,” could be a bit confusing. The “storage types” you list on that slide are the types that the database uses to store data internally, but an AIR developer doesn’t ever access/use those types directly.

There’s a somewhat larger list of available data types that you use when you declare a column in a CREATE TABLE statement (the documentation calls these “column affinities”):
http://livedocs.adobe.com/flex/3/langref/localDatabaseSQLSupport.html#columnAffinity

Of course, I didn’t see your presentation so I realize that it’s very possible you covered that in the presentation — I’m sure you gave more information than just the bullets in the slides =)

8 04 2008
Peter (00:10:28) :

Bobby, fixed that issue — the presentation should now available for download from slideshare.net under a Creative Commons license.

Good point Paul, thanks! I actually didn’t talk about affinities — but of course there’s only so much you can cram into 30 minutes ;)

On that slide I added the direct equivalent for AS3 within parentheses but you can use certain other AS3 data types as described in the livedocs you pointed out which are then ultimately treated as one of those basic storage types in SQLite.

8 04 2008
Jeroen (09:49:02) :

Thanks for the slides and sources Peter!
It was a great presentation, you did a good job in turning a “boring” subject into something interesting to watch and listen. And Rick Astley rocks.

8 04 2008
luca mezzalira (10:57:21) :

Hi Peter!!
It was a GREAT preso, I think to find you at 360Flex in Milan but it will be next time I hope! :D

8 04 2008
roScripts - Webmaster resources and websites (23:15:14) :

Peter Elst » Introduction to SQLite in Adobe AIR…

Peter Elst » Introduction to SQLite in Adobe AIR…

8 04 2008
Sean Voisen (23:43:09) :

I’m giving a similar presentation at FITC in Toronto in a few weeks. Looks like we’re covering a lot of the same material. I’ll be sure to point people to your demo apps.

9 04 2008
Peter (21:05:48) :

@sean — I noticed you’re doing that presentation, shame I can’t make it to Toronto this year. Enjoy the conference!

@luca — looking forward to seeing you at Scotch on the Rocks!

9 04 2008
Mirano « Zeg niet dat je het niet wist (21:50:45) :

[...] 9 april 2008 door Koen Maandag was ik samen met enkele collega’s in Brussel voor de Adobe on AIR Tour. Heel wat leuke dingen gezien. Peter Elst toonde een applicatie die het mogelijk maakt om filmpjes van YouTube te downloaden om ze later off-line te bekijken en zelfs te bewaren op de harde schijf. Applicatie is te downloaden op zijn blog. [...]

10 04 2008
mario (00:06:08) :

hello,
Thanks for the slides and sources, help me a lot. I’m new in air….
One question: How can i make “drag and drop” like the example above “SQLite Contact Manager”

16 04 2008
on AIR Weblog (06:04:06) :

[...] is a video of Peter Elst’s session on SQLite from the on AIR Tour event in Brussels. [...]

17 04 2008
mario (02:59:40) :

thanks!
this video was a great help…

I´m very Grateful, Peter Elst’s …

22 04 2008
101 Adobe AIR Resources to Add to Your Toolbelt of Awesomeness (06:27:17) :

[...] Introduction to SQLite in Adobe AIR - peterelst.com [...]

24 04 2008
on Air Brussels - Kristof Neirynck (09:00:45) :

[...] can watch it yourself and the slides and apps are online too. This was my favorite session of the day. There is something about storing flvs from [...]

24 04 2008
Celi Online » 101 Recursos para Adobe Air (23:38:06) :

[...] Introduction to SQLite in Adobe AIR - peterelst.com [...]

27 04 2008
101 Adobe AIR Resources to Add to Your Toolbelt of Awesomeness | AIR + Flex Laboratory. (15:34:35) :

[...] Introduction to SQLite in Adobe AIR - peterelst.com [...]

28 04 2008
AIR Bus Tour : Weblog (18:32:21) :

[...] Peter Elst has posted his slides and source for his on AIR Tour session on SQLite and Adobe AIR. You can grab all of the slides from Peter’s website here. [...]

7 05 2008
101 Recursos para Adobe Air | Nodo54 (19:35:05) :

[...] Introduction to SQLite in Adobe AIR - peterelst.com [...]

17 05 2008
flex jest genialny « Przez brudne szkło okularów (20:23:55) :

[...] flex jest genialny maj 17, 2008 Kategoria wpisu: flex — l0cke @ 20:23 Genialny tutorial do sqlite (jak narazie najlepszy jaki znalazłem) można znaleźć pod tym linkiem : link [...]

28 05 2008
Peter Elst » 2M08 in review (08:56:21) :

[...] a lot of the example code and the SQLite wrapper classes I talked about are available in the “Introduction to SQLite in Adobe AIR” post I did a while back, the “AIR Badge Wordpress Plugin” is available [...]

11 06 2008
SQLite with AIR tutorial, conquer the DB. at 9MMEDIA Blog (21:41:02) :

[...] into Wrapper classes. I’ve tested a couple. Peter Elst has a nice blog post. I’ve also had limited success but am curious about the Air Active-Record [...]

17 06 2008
BoodschappenManager v1.0 (12:58:36) :

[...] Bij de connectie met de SQlite Database maak ik gebruik van dit component [...]

5 07 2008
Aseem (04:34:56) :

I have a question for Peter Elst.
Is it possible to convert the SQLite YouTube Database application into a Flex application so that it runs inside the web browser as a web application? or will there be security issues in doing that?
Please let me know.

5 07 2008
Peter (20:36:14) :

Aseem you could technically port the SQLite YouTube AIR app to the web but you’ll have to use a server-side scripting language to write the video to the database.

In the browser you’ll also more easily run into memory issues, it might work but wouldn’t really recommend it. There’s also no real point of saving FLV’s from YouTube in your own database, you can just as well play them directly from there.

7 07 2008
Adobe AIR相關學習網頁 於傻仔仔 (17:06:45) :

[...] development models - adobe.com Dealing with Asynchronous Queries in Adobe AIR - alternateidea.com Introduction to SQLite in Adobe AIR - peterelst.com Most of the Brands are using Adobe AIR applications - developersnippets.com Query a [...]

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>





Conferences

Flash on the Beach Speaker

Training Partners

multimediacollege

SkillsMatter

Badges

Alltop, confirmation that I kick ass

  • Categories

    • AIR RSS category feed
    • Ajax RSS category feed
    • CSS RSS category feed
    • Eclipse RSS category feed
    • Events RSS category feed
    • Flash RSS category feed
    • Flash Lite RSS category feed
    • Flex RSS category feed
    • Gadgets RSS category feed
    • General RSS category feed
    • JSFL RSS category feed
    • Mac RSS category feed
    • Open Source RSS category feed
    • PHP RSS category feed
    • Podcasts RSS category feed
    • Publications RSS category feed
    • Rants RSS category feed
    • Reviews RSS category feed
    • Thought of the Day RSS category feed
    • Training RSS category feed
    • Twitter RSS category feed
    • Video RSS category feed
  • Resources

    • Sam Robbins
    • Veronique Brossier
    • Ted Patrick
    • Abdul Qabiz
    • Burak Kalayci
    • Matthew David
    • Chafic Kazoun
    • Jesse Warden
    • Keith Peters
    • Serge Jespers
    • Sas Jacobs
    • Simon Barber
    • Branden Hall
    • Robert M. Hall
    • Richard Leggett
    • Rich Tretola
    • Aral Balkan
    • LordAlex Leon
    • Jonathan Kaye
    • Stephen Downs

     
     

    Adobe Community Expert

    See my profile on LinkedIn



    Harz Ferienwohnung Suchmaschinenoptimierung Geschenkideen Harz Ferienwohnung Pagerank Webkatalog Webhosting