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

Transactions – reading/writing


When a SELECT statement is used within SQLite, it moves from a default status of UNLOCKED to SHARED, and once the statement is committed, it reverts to UNLOCKED. There are several states for transaction lock states and locking works when there is autocommit on or transactional control with autocommit off within a begin/end statement arrangement. When there is some contention, the transactional locking states may alter from UNLOCKED to SHARED, RESERVED, or EXCLUSIVE.

If an update is to take place, the programmer may code it so that an EXCLUSIVE lock is used. This stops updates from other processes, just until the job has been done and the lock is released. In this case, the programmer must also code and put up a message or write to the log file; if this happens, auditors or database administrators will have an audit trail of events during the lifetime of an application. It is a very good practice to do so.