AIR Active Record

Jacob Wright
December 19th, 2007

I’ve been working with AIR quite a bit since my side project is in AIR. I thought it would be pretty cool to create an active record implementation in AIR since I’ve got one on the server side.

I have to use synchronous database connections for it so that everytime I access an object’s related properties I don’t have to use a callback, though it could be refactored to do that. Not my idea of fun though, and after an excellent presentation by Jason Williams, “Working with Persistent Data in AIR,” where he showed how fast it was to retrieve data from an AIR database I figured it would be just fine.

Currently I don’t have metadata allowing you to define how every property maps to a field in the database, nor do I have many “special case” hooks for this and that. I figured that any AIR app you write will be using a fresh database and not a legacy system. How many desktop apps using a SQLite database will you be updating with AIR and using the same database file? Maybe I’m wrong, but I don’t think so.

I also added a piece that you can run which will create and update database tables based off the ActiveRecord object’s properties. So you have a nice update mechanism for the database when you update your app using the updater api.

I’ll be open-sourcing the code when I have time (isn’t that always the case), but you can get the code now, test it out, and let me know what enhancements you’d like to see. Sorry, no documentation currently. If I like the ideas or they’re requested enough I’ll be sure to add them in. :)

Oh, and when you unzip it you’ll see “flight” is the package Tyler (my twin) and I are using for our projects. It started when he and Rob Taylor started a component set in AS2 under the name but AS3 and Flex 2 came out and they never finished. Maybe an AS3 set will happen someday.

Update: AIR Active Record is open sourced.

4 Responses to “AIR Active Record”

  1. Jim Says:

    Personally, I’d be very interested in something like this. I’ve been too spoiled by ActiveRecord to want to deal with the DB directly.

  2. Keith Says:

    Hi, I was wondering if you were still planning on releasing this code under an open source license? I’d love to use it but I’d hate to step on your toes, nor do i want to invest a lot of effort only to have to rip out the DB layer if your license requires the full app to be open source a lá GPL.

  3. Jacob Wright Says:

    It will be under the MIT license if that is good for you. I will get that up on a Google Code project today if possible.

    Thanks for following up with me on that!

  4. AIR ActiveRecord is Open Source Says:

    [...] wrote about an Active Record implementation for the Adobe Integrated Runtime using it’s SQLite database functionality. I [...]

Leave a Reply