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

Using the SQLite 3 Library


Before starting to code, you must add a specific library for SQLite. Within Xcode, ensure that the General tab is selected and visible. At the end of the page, look out for the Linked Frameworks and Libraries section. View and click on the icon with the plus sign, as shown in the following screenshot:

A modal window will appear; please enter the word sqlite, and from the list of information, select the libsqlite3.dylib option, as shown in the following screenshot:

After selecting it, click on the Add button to move forward.

As part of this chapter, we will use FMDB and an Objective-C wrapper around SQLite to show the database SQLite with Swift. FMDB stands for Flying Meat Database, and it easily interacts with SQLite and actually saves time and effort. For example, the FMDB will be linked to one SQLite database and will be there for the execution of SQL queries. The output is FMResultsSet, which shows results for queries executed on the FMDB.

Note

The class of FMDatabaseQueue...