Flex-based SQLAdmin for Google Gears


I spent the last few days building a Flex/Google Gears integration demo that Kevin Lynch demonstrated during the Gears announcement today at the Google developer day in San Jose.

The demo is a Flex-based Sales Force Automation application that uses Gears to save data to a local SQLite database while offline, and automatically synchronizes back with the server when you reconnect to the network. There is a browser-based version of the application using Gears for the local database access, and an Apollo version using Apollo’s built-in SQLite support. I will post the code and more information about the application after cleaning it up a little bit.

In the meantime, here is a SQLAdmin app that I built to help me manipulate my Gears database as I was building the demo. It allows you to look at the content of your Gears SQLite database and execute any type of SQL statement (Click New Query in the menu).

You can run the application here. Per Gears’ security model, the database you create will be saved on your computer in a coenraets.org sandbox (databases cannot be shared across different domains). View source is enabled: right click and select View Source.

To use the app with your own databases, download the application here, and run it from the same domain as the database you wish to inspect.

If you are a Flex developer, this application also higlights the key steps to start using Gears in your own Flex application:

  1. Import Google’s gears_init.js in your HTML wrapper
  2. Add a couple of JavaScript functions. In this application I only defined one generic executeSQL() function that is called by the Flex app as appropriate.
  3. Your Flex app integrates with gears through ExternalInterface. In this app I abstracted the calls to Gears in a simple Database.as class

The source code is available here

NOTE: Make sure you install Google Gears before running the app.