Chapter 5. Using local databases

 

This chapter covers

  • Using basic SQL
  • Creating databases
  • Running SQL statements
  • Adding parameters
  • Retrieving record sets

In chapter 3, you learned how to work with the file system. Using a file system allows you to store data in a persistent fashion and organize that data in a variety of ways. Writing data to files is a great solution in some cases. For example, files are ideal for writing binary data such as images or videos that your application will need to load at runtime. Files are also great for portability. If you want to output text to a format that a user can easily send to a friend, a file is good for that. But as useful as files may be, they’re not a panacea for all things data. In this chapter, we’ll look at a more efficient way to work with some types of data: local databases. A database allows you to store data persistently. Most databases also have a language that allows you to store and retrieve data in an efficient way. AIR uses a type of database called SQLite, and SQLite databases use a language called Structured Query Language, which is usually written as SQL.

Note

SQL is pronounced differently by different people. Some prefer to spell out the letters, as in Ess-Cue-El. Others prefer to pronounce SQL just like the word sequel. In this book we’ve chosen the latter option. That means you’ll see us refer to a SQL statement instead of an SQL statement.

5.1. What is a database?

 
 
 
 

5.2. Understanding SQL

 
 
 
 

5.3. Creating and opening databases

 
 

5.4. Running SQL commands

 
 
 

5.5. Building a ToDo application

 
 

5.6. Working with multiple databases

 
 
 

5.7. Adding database support to AirTube

 
 
 

5.8. Summary

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest