O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning SQLite for iOS

Book Description

Extend SQLite with mobile development skills to build great apps for iOS devices

About This Book

  • Implement Swift code using SQLite statements
  • Learn the background to SQL and SQLite for mobile development, its statements, and command features through practical examples
  • Extend the standard SQLite functionality and increase your software creation portfolio

Who This Book Is For

This book is intended for those who want to learn about SQLite and how to develop apps in Swift or HTML5 using SQLite. Whether you are an expert Objective-C programmer or new to this platform, you'll learn quickly, grasping the code in real-world apps to use Swift.

What You Will Learn

  • Explore Swift's basic language statements
  • Connect to SQLite and execute SQL statements
  • Extend the SQLite language to create your own software extensions
  • Use HTML5 with Phonegap on iOS
  • Set up a Swift project using XCode with SQLite
  • Administer SQLite databases in an easy and effective way

In Detail

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.

Style and approach

This book is a practical and comprehensive guide to developing applications using SQLite and iOS.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Learning SQLite for iOS
    1. Table of Contents
    2. Learning SQLite for iOS
    3. Credits
    4. About the Author
    5. About the Reviewer
    6. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Introduction to SQL and SQLite
      1. About SQL
      2. Where does SQLite stand in today's industry?
      3. iOS with SQLite
      4. Embedded databases
      5. The architecture of the SQLite database
      6. Features
      7. The advantages of using SQLite
      8. Working with SQLite
      9. The examples of using SQLite with iOS
      10. Summary
    9. 2. Database Design Concepts
      1. Database essentials
      2. Reasons for using SQLite
      3. Database connections
      4. Preparing queries
      5. Parameterized SQL
      6. Error handling
      7. Queries within the db.exec statement
      8. SQL injection attacks
      9. Creating user-defined functions
      10. Transactions and locks
      11. Transactions – reading/writing
      12. Designing for SQLite
      13. Summary
    10. 3. Administering the Database
      1. Creating a database
        1. Creating a table
        2. Inserting data
        3. Selecting data
        4. Creating an index
        5. Exporting data
      2. Viewing database schema data
        1. Index data
        2. Schema data
      3. Backing up the database
      4. Database tools
      5. Database file information
      6. Summary
    11. 4. Essentials of SQL
      1. Transactions
      2. Query plan
      3. SQL basics
        1. Insert with a subselect clause
        2. Update with a subselect clause
        3. Select with a subselect clause
      4. Data integrity
      5. Default values
        1. Constraint checking
        2. Foreign keys
      6. Updating Views
      7. Index use
      8. Triggers
      9. Synchronous writes
      10. Database locking and deadlocks
      11. FMDB SQLite wrapper
      12. Database creation and opening
      13. SQL in iOS
      14. Summary
    12. 5. Exposing the C API
      1. SQLite C components' functionality
        1. sqlite3_open()
        2. sqlite3_prepare()
        3. sqlite3_step()
        4. sqlite3_column()
        5. sqlite3_finalize()
        6. sqlite3_close()
          1. Using the C API with the open database statement
          2. Using Swift with the open database statement
        7. load_extension()
        8. sqlite3_exec()
        9. sqlite3_config()
        10. The prepare statement
      2. Summary
    13. 6. Using Swift with iOS and SQLite
      1. Basic requirements
      2. Starting an Xcode Project with Swift
      3. Using the SQLite 3 Library
        1. Using FMDB
      4. Summary
    14. 7. iOS Development with PhoneGap and HTML5
      1. HTML5 and PhoneGap development
      2. An HTML5 framework
      3. Hybrid applications
      4. An Xcode project with PhoneGap, HTML5, and Swift
      5. Summary
    15. 8. More Features and Advances in SQLite
      1. PhoneGap plugins
      2. Extensions to the C API
      3. Write Ahead Logging with SQLite
      4. The B-tree usage with SQLite
      5. Creating a simple Swift
      6. Summary
    16. Index