| Recent
Articles |
ADO.NET Picks Up SQL Provider Support IBM, MySQL, and other SQL database providers plan to support the ADO.NET Entity Framework, currently available as version Beta 3. Microsoft has touted ADO.NET as an easier mechanism for constructing data...
New SQL Server Backup Solution Developed By... A new SQL Server backup solution has been developed by Cortex I.T. Labs (developers of BackupAssist) and it is said to be unique. The product apparently provides not only disaster recovery of critical data, but complete...
Single Quotes In A Query Issue Alex had a problem with his SQL. This is actually a frequently asked question and I've covered it here before (I think so anyway), but I thought I'd mention it again. It comes up from time to time as people forget.
Oracle SQL Developer 1.2 Oracle released the latest version of its SQL Devleoper the other day, version 1.2. This version features new capabilities to ease the migration and consolidation of third-party databases onto Oracle Database...
Using Pligg As An Easy Corporate Web 2.0 Site For those who do not know the Pligg system is a digg clone site that allows people to submit and vote on stories, we run one as a way to collect social book marks and things we think are important at work, and...
SQL Server Express & Remote Access What a pain this has been! I've never dealt with Microsoft SQL Server before but now that Vista runs acceptably on VMware Fusion, I figured that it would be a good opportunity to install SQL Server Express as...
|
 |
|
01.04.08
Flex, AIR, And SQL By Raymond Camden
I decided to give myself a new AIR/Flex project, one that would specifically use the built-in database. My project was a simple one - a time tracker.
I currently use Side Job Track to track all of my clients, projects, and hours. While this has the benefit of being a web site and available from multiple locations, it has a few quirks that really bug me. It just doesn't flow right for me. It is also a bit slow. All in all - I'm just tired of using it and figured, why not build something better? Since I'll be the only user, I'll have exactly one person to please, so how hard can that be?
I began by deciding to use Flex. I really like the HTML side of AIR, but I've got to practice my Flex more. I'm not going to show a lot of my Flex code as it - well - sucks - but let's take a look at how easy it is to use databases in AIR.
You begin my creating/opening your database. The cool thing is that this is all one statement. When you connect to a database AIR will simply create it if it doesn't exist. So my Flex app runs the following code:
So line by line, let me describe what is going on - and let me remind folks - I'm learning this myself. If I get the details wrong, please correct me.
The first line simply creates a connection object. We are going to use this as our main "pipe" to our database.
The second line simply creates a file pointer. The applicationStorageDirectory is a shortcut to a private area for my application. Basically, it asks AIR to give me a file name in a special place just for my application. I love how AIR does that. The file name I picked, data.db, is nothing special.
Next up is the init() function. I have this running from the creationComplete() of my Flex app. I add two events to my connection. One for an error, one for success. I then simple open it. Again - here is where AIR will create the database if it doesn't exist.
Continue reading this article.
About the Author: Raymond Camden, ray@camdenfamily.com
http://ray.camdenfamily.com
Raymond Camden is Vice President of Technology for roundpeg, Inc. A long
time ColdFusion user, Raymond has worked on numerous ColdFusion books
and is the creator of many of the most popular ColdFusion community web
sites. He is an Adobe Community Expert, user group manager, and the
proud father of three little bundles of joy.
|