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

Default values


The default values for columns is valuable because it enforces data integrity and ensures that a value is entered on the database. It also means that some SQL statements are smaller than others. A standard type of statement without its column being added is an id field, where the primary key is defined, and when an INSERT statement is used, the id field is not required, as shown in the following.

The DBA can create columns to store current_timestamp in the database automatically, which is good for logging and time stamping.

sqlite> INSERT into salary (name, salary, bonus) values ('John Smith',15000,2000); sqlite> SELECT * FROM salary;

id            name         salary    bonus
-----       --------     ---------  --------
1           Peter Jones   10000      3000
2           Sam Smith     15000      1000
3           John Smith    15000      2000

Constraint checking

To ensure that the right data is inputted into columns on a table, certain rules are imposed, and these are...