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

Database locking and deadlocks


A deadlock occurs when one or many actions or SQL statements compete for data access and table updates or manipulation at the same time as another process or action. Since it works with a transaction, one process can't move forward or complete because the other process or action holds, and is waiting for a resource, hence a deadlock.

So, in a database, records of process one would attempt to update, but process two would like to update some of the same rows, or a conflict of another table in which the transaction occurs. Some form of data locking mechanism to manage and reduce conflict must happen. Code around the transaction can be added with a retry indicator of three, for example, so if there is a deadlock, it will retry, and after the third attempt, it would roll back or give the user an opportunity to retry.

Deadlocking is a common occurrence in multithreaded and multiprocessing operating systems, which are performing a variety of tasks and attempting to...