Book Image

Learning SQLite for iOS

By : Gene Da Rocha
Book Image

Learning SQLite for iOS

By: Gene Da Rocha

Overview of this book

The ability to use SQLite with iOS provides a great opportunity to build amazing apps. Apple's iOS SDK provides native support for SQLite databases. This combination offers the potential to create powerful, data-persistent applications. This book starts with the architecture of SQLite database and introduces you to concepts in SQL . You will find yourself equipped to design your own database system, administer it, and maintain it. Further, you will learn how to operate your SQLite databases smoothly using SQL commands. You will be able to extend the functionality of SQLite by using its vast arsenal of C API calls to build some interesting, exciting, new, and intelligent data-driven applications. Understand how Xcode, HTML5, and Phonegap can be used to build a cross-platform modern app which can benefit from all these technologies - all through creating a complete, customizable application skeleton that you can build on for your own apps.
Table of Contents (15 chapters)
Learning SQLite for iOS
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Viewing database schema data


SQLite offers several commands as part of a command set to get information about the contents of a database. For example, to get a list of tables, use the .table command. To find a specific table name, use a % symbol and text as a pattern to find the result, for example, .tables [pattern], as shown in the following screenshot. By issuing the .tables command and appending a %te% text to it, is a request to SQLite to list all its tables within the database that has the word te (in our case temp) in their name which are displayed correctly:

Index data

Prior to the following example, a temp_idx index has been created, to get a list of indexes for the temp table, at the sqlite3 prompt .indices temp, which is actually the .indices command followed by the table name, as shown here:

By using the preceding command, the temp table's index can be seen.

Schema data

To view the schema of the database, the following command can be issued, .schema, but type the .schema <table...