<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" 
      xmlns:thr="http://purl.org/syndication/thread/1.0">
  <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html" />
  <link rel="self" type="application/atom+xml" href="http://www.insideria.com/atom.xml" />
  <id>tag:www.insideria.com,2009://34/tag:www.insideria.com,2008://34.23230-</id>
  <updated>2009-11-05T20:16:34Z</updated>
  <title>Comments for AIR API - Introduction to the SQLite Database (http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html)</title>
  <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.21-en</generator>
  <entry>
    <id>tag:www.insideria.com,2008://34.23230</id>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.oreilly.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=34/entry_id=23230" title="AIR API - Introduction to the SQLite Database" />
    <published>2008-03-28T04:55:41Z</published>
    <updated>2008-04-18T12:24:14Z</updated>
    <title>AIR API - Introduction to the SQLite Database</title>
    <summary>

One of the most powerful features in Adobe AIR is the native integration of SQLite that was introduced in Beta 2.  Since Beta 2 it&apos;s integration has been improved, and it is now a viable local database capable of storing application data or syncing with a database server.  The implementation provided with AIR is powerful and provides two distinctly different ways to access the database.  There are nineteen different classes that can be used with this API, and in the next few articles I will dissect the ones that you need to know.</summary>
    <author>
      <name>David Tucker</name>
      <uri>http://www.davidtucker.net/</uri>
    </author>
    
    <category term="Blogs" />
    
    <content type="html" xml:lang="en" xml:base="http://www.insideria.com/">
      <![CDATA[<div class="ap_r" style="margin: 0 16px 16px 16px;"><a href="http://www.insideria.com/airLogo-Shadow.jpg" class="highslide" onclick="return hs.expand(this)"><img src="http://www.insideria.com/airLogo-Shadow.jpg" alt="airLogo-Shadow.jpg" title="Click to enlarge" width="148"/></a></div>

<p>One of the most powerful features in Adobe AIR is the native integration of SQLite that was introduced in Beta 2.  Since Beta 2 it's integration has been improved, and it is now a viable local database capable of storing application data or syncing with a database server.  The implementation provided with AIR is powerful and provides two distinctly different ways to access the database.  There are nineteen different classes that can be used with this API, and in the next few articles I will dissect the ones that you need to know.</p>

<h2><strong>What is SQLite</strong></h2>

<p><a href="http://www.sqlite.org/" target="_blank">SQLite</a> is an open-source lightweight relational database system developed by <a href="http://en.wikipedia.org/wiki/D._Richard_Hipp" target="_blank">D. Richard Hipp</a>.  SQLite differs from traditional server based databases in several ways.  First, an SQLite database is completely self-contained in a single cross-platform file.  This works well for AIR, because the same database file can work on a Windows, Mac, or Linux machine.  Second, SQLite handles column types in a different manner.  Essentially, SQLite types the fields as well as the columns.  This allows fields in a column to be of different data types.  </p>

<h2><strong>Asynchronous vs. Synchronous</strong></h2>

<p>As I mentioned earlier, there are two different modes in which you can use to connect to an SQLite database in AIR: synchronous and asynchronous.  </p>

<p><strong>Synchronous:</strong> This method requires much less code.  With this method you don't have to use event handlers when retrieving data.  If you have a method call below your database query, you can be sure that it will not execute until the query has been completed.  This seems like a great thing, but a synchronous call will also keep any other methods from executing during your query.  In this case, the user's experience is basically 'paused' during your query.  To avoid this undesirable effect, you will need to use the asynchronous mode.</p>

<p><strong>Asynchronous:</strong> This method will take more code.  You will have to add event listeners and event handlers.  The benefit is that the user experience will be uninterrupted during your query.  This is ideal for most situations except for very simple instances.</p>

<p>For these tutorials I will be using asynchronous calls.  If you can master the programming used with asynchronous calls, using synchronous calls will be very easy.</p>

<h2><strong>SQLite Administration Resources</strong></h2>

<p>There are many different tools that you can use to administer your SQLite databases.  I have listed three of these below.  You will need one of these tools for the upcoming tutorials.  I use both of the first two that I have listed (and I had the third one recommended by another developer).</p>

<p><a href="http://coenraets.org/blog/2008/02/sqlite-admin-for-air-10/" target="_blank">SQLite Admin AIR Application</a><br /><a href="http://code.google.com/p/sqlite-manager/" target="_blank">SQLite Manager Firefox Extension</a><br /><a href="http://sqlitebrowser.sourceforge.net/" target="_blank">SQLite Database Browser</a></p>

<p><strong>Next Tutorial</strong>: In the next article, I will cover connecting to a pre-existing database and executing a simple query on that database.  As always let me know if you have any specific questions.</p>]]>
      
    </content>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23230-comment:2016190</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23230" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html#comment-2016190" />
    <title>Comment from Rhys Tague on 2008-03-27</title>
    <author>
        <name>Rhys Tague</name>
        <uri>http://www.rhycom.com.au</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.rhycom.com.au">
        <![CDATA[<p>Hey David,<br />
This looks like it is going to turn out to be a good series of posts. SQLite is underused in my opinion. Most people I think just store information in a file and don't harness the power of SQLLite.</p>

<p>Also having SQLLite especially in AIR apps is going to be tremendous as when a client looses connectivity they can have a history to browse through, instead of disabling everything.<br />
What do you think?</p>

<p>cheers,</p>]]>
    </content>
    <published>2008-03-28T04:42:09Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23230-comment:2016193</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23230" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html#comment-2016193" />
    <title>Comment from David Tucker on 2008-03-28</title>
    <author>
        <name>David Tucker</name>
        <uri>http://www.davidtucker.net/</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.davidtucker.net/">
        <![CDATA[<p>Exactly.  These are just a few of the uses that I believe developers will embrace with the integrated SQLite database.  </p>]]>
    </content>
    <published>2008-03-28T14:18:04Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23230-comment:2016226</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23230" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html#comment-2016226" />
    <title>Comment from Adrian Aioanei on 2008-03-30</title>
    <author>
        <name>Adrian Aioanei</name>
        <uri>http://blogs.eyepartner.com/adrian</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://blogs.eyepartner.com/adrian">
        <![CDATA[<p>I've used this in some projects, works like a charm. Never used sync with server database though but i think wont be much work either.</p>

<p>One issue that i see here is when you try to move the AIR application to lets say another computer. Right now you can't "package" the AIR application along with the database files and then simply install it on the other computer just as you install an AIR application.</p>

<p>Is that possible somehow right now ? Or will it be figured out in the future ?</p>

<p>Adrian</p>]]>
    </content>
    <published>2008-03-30T19:14:41Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23230-comment:2016661</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23230" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html#comment-2016661" />
    <title>Comment from Vivian Richard on 2008-04-18</title>
    <author>
        <name>Vivian Richard</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Hi David...</p>

<p>You spoiled us!!!! We want another great video tutorial series like Cairngorm not just post tutorial. I am sure you can do that for us!!!!</p>

<p>Cheers.....</p>]]>
    </content>
    <published>2008-04-18T20:15:18Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23230-comment:2016662</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23230" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html#comment-2016662" />
    <title>Comment from David Tucker on 2008-04-18</title>
    <author>
        <name>David Tucker</name>
        <uri>http://www.davidtucker.net/</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.davidtucker.net/">
        <![CDATA[<p>@Adrian - Check out <a href="http://www.insideria.com/2008/04/air-api-retrieving-results-fro.html">http://www.insideria.com/2008/04/air-api-retrieving-results-fro.html</a> and let me know if the section on including a pre-populated database answers your question.</p>

<p>@Vivian - Who knows - I might be able to add a few video tutorials to this.  I will do my best to work that in :)</p>]]>
    </content>
    <published>2008-04-18T20:52:40Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23230-comment:2044203</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23230" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html#comment-2044203" />
    <title>Comment from sandeep on 2008-10-13</title>
    <author>
        <name>sandeep</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Its great to know about AIR.Suppose i am packaging a html file and creaing desktop application,then hw can i connect it to database server not local db to my main server</p>]]>
    </content>
    <published>2008-10-14T05:14:06Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23230-comment:2044542</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23230" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html#comment-2044542" />
    <title>Comment from sandeep on 2008-10-20</title>
    <author>
        <name>sandeep</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>if i am pakaging jsp pages hw can i sync with database server</p>]]>
    </content>
    <published>2008-10-21T06:01:43Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23230-comment:2055071</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23230" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html#comment-2055071" />
    <title>Comment from dieyana on 2009-03-12</title>
    <author>
        <name>dieyana</name>
        <uri>http://-</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://-">
        <![CDATA[<p>hye...i'm interested in you article.but u didn't mention on how an application can save data in the database.for example,when user click the 'save' button,all the data in that application can be saved into the database.</p>]]>
    </content>
    <published>2009-03-13T03:18:55Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23230-comment:2055168</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23230" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html#comment-2055168" />
    <title>Comment from David Tucker on 2009-03-14</title>
    <author>
        <name>David Tucker</name>
        <uri>http://www.davidtucker.net</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.davidtucker.net">
        <![CDATA[<p>@dieyana - There isn't an integrated way to save the application's model state at a given point in time, but rather AIR gives the developer the flexibility to add it in whatever way works best.  I will be covering some ORM options for AIR in the upcoming weeks, and you might find those helpful!</p>

<p>Thanks for the comment.</p>]]>
    </content>
    <published>2009-03-14T14:19:22Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23230-comment:2075892</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23230" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/03/air-api-introduction-to-the-sq.html#comment-2075892" />
    <title>Comment from developar on 2009-08-31</title>
    <author>
        <name>developar</name>
        <uri>http://www.developar.com</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.developar.com">
        <![CDATA[<p>Nice to know the difference between Asynchronous & Synchronous method, thanks</p>]]>
    </content>
    <published>2009-08-31T08:54:14Z</published>
  </entry>

</feed
