Chapter 12. Local Databases

WHAT'S IN THIS CHAPTER?

  • Introducing SQLite

  • Opening a database connection

  • Selecting records from the database

  • Inserting or updating records

Although you can use XML or binary files to store application or user data, you also can make full use of relational SQL databases right inside your Android and iOS applications. This chapter introduces you to working with local relational databases in your Android and iOS apps.

All operations you perform on the database are not done with AS3, but SQL (Structured Query Language), which is the standard query and data management language for relational databases. Using SQL, you can create tables, perform queries, and insert or modify records.

WORKING WITH A SQLITE DATABASE

One component of the underlying Adobe Integrated Runtime (AIR) engine that is part of AIR for Android run time and compiled into Flash-based iOS apps is SQLite, a SQL relational database engine. As a result, you can use the SQL database library API that is part of AIR to work with a local database in your mobile application.

SQLite is a lightweight open-source database engine that stores relational database data in a local file (often with a .db extension) that you can specify. (For more information on SQLite, go to www.sqlite.org.)

For example, using SQLite, you can create database-oriented apps that run offline and sync with a back-end server periodically when the user is connected to the Internet. You may also want to use the database as an alternative to ...

Get Professional Flash® Mobile Development: Creating Android™ and iPhone® Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.