Introducing SQLite for Mobile Developers

Book description

This brief book is a basic introduction to SQLite for iOS and Android developers. The book includes a simple introduction to SQL, a discussion of when to use SQLite, and chapters devoted to using SQLite with the most likely programming languages: Java, PHP, Swift and Objective-C. It then goes through adding simple database functionality to an Android or iOS app and finally a chapter on managing the app’s life cycle.

Table of contents

  1. Cover
  2. Title
  3. Copyright
  4. Contents at a Glance
  5. Contents
  6. About the Author
  7. About the Technical Reviewers
  8. Acknowledgments
  9. Introduction
  10. Chapter 1 : Getting Up to Speed with Databases and SQLite
    1. Moving Beyond Big
      1. Databases Are Structured and Organized
      2. Databases Are Smart
    2. Relational Databases and SQL to the Rescue
    3. Looking Inside a Relational Table and Query
      1. Basic Query Structure
      2. Looking at Other Query Choices
  11. Chapter 2 : Understanding What SQLite Is
    1. Putting a Database in Perspective
    2. Defining SQLite
      1. SQLite Is Designed for a Single User
      2. SQLite Is Self-Contained
      3. SQLite Supports Transactions and Is ACID-Compliant
  12. Chapter 3 : Using SQLite Basics: Storing and Retrieving Data
    1. Using sqlite3
      1. Run sqlite3 and Let It Create a New Database
      2. Create and Name a New sqlite3 Database
      3. Delete the Database
      4. Run sqlite3 and Open an Existing Database
    2. Experimenting with SQLite Syntax
    3. Exploring Your sqlite3 Database with a Graphical SQLite Editor
    4. Creating a Table
      1. Using a Graphical SQLite Editor
      2. Creating Table Columns
      3. Using SQLite3
    5. Inserting Data into a Table
      1. Using a Graphical User Interface
      2. Using SQLite3
    6. Retrieving Data
      1. Using a Graphical User Interface
      2. Using sqlite3
    7. Deleting Data
    8. Summary
  13. Chapter 4 : Working with the Relational Model and SQLite
    1. Building the Users Table
    2. Building the Scores Table
    3. Relating the Tables
      1. Using Aliases to Identify Multiple Tables in a SELECT Statement
      2. Using the rowid Primary Key
      3. Changing a Name in One Table
      4. Using a Foreign Key
    4. Joining the Tables
    5. Summary
  14. Chapter 5 : Using SQLite Features—What You Can Do with SELECT Statements
    1. Looking at the Test Data
      1. Ordering Data Makes It Easier to Use
      2. Grouping Data Can Consolidate It
    2. Using Variables in Queries
    3. Summary
  15. Chapter 6 : Using SQLite with PHP
    1. Putting PHP and SQLite Together: The Basics
      1. Verifying PHP in Your Environment
      2. Preparing the SQLite Database
    2. Connecting to Your SQLite Database
      1. 1. Create a New PDO Object
      2. 2. Create and Prepare the Query
      3. 3. Execute the Query
      4. 4. Fetch the Results
      5. 5. Use the Results
    3. Summary
  16. Chapter 7 : Using SQLite with Android/Java
    1. Integrating SQLite with Any Operating System, Framework, or Language
    2. Using Android and SQLite
      1. Using the Static Values
      2. Extend SQliteOpenHelper
    3. Summary
  17. Chapter 8 : Using SQLite with Core Data (iOS and OS X)
    1. Introducing the Core Data Framework
    2. Using the Core Data Model Editor
      1. Using Entities
      2. Working with Attributes
      3. Managing Relationships
    3. Summary
  18. Chapter 9 : Using SQLite/Core Data with Swift (iOS and OS X)
    1. Looking at the Core Data Stack
    2. Fetching Data to the Core Data Stack
    3. Structuring a Core Data App
      1. Passing a Managed Object Context to a View Controller in iOS
      2. Setting Up the Core Data Stack in AppDelegate for iOS
      3. Setting Up the Core Data Stack in AppDelegate for OS X
    4. Creating a Fetch Request in iOS
    5. Saving the Managed Object Context
      1. Saving in iOS
      2. Saving in OS X
    6. Working with NSManagedObject
      1. Creating a New NSManagedObject Instance
    7. Working with a Subclass of NSManagedObject
    8. Summary
  19. Chapter 10 : Using SQLite/Core Data with Objective-C (iOS and Mac)
    1. Looking at the Core Data Stack
    2. Fetching Data to the Core Data Stack
    3. Objective-C Highlights
      1. Using Quoted Strings
      2. Objective-C Is a Messaging Language
      3. Using Brackets in Objective-C
      4. Chaining Messages
      5. Ending Statements with a Semicolon
      6. Separating Headers and Bodies in Objective-C
      7. Looking at Method Declarations
    4. Handling nil in Objective-C
    5. Structuring a Core Data App with Objective-C
      1. Passing a Managed Object Context to a View Controller in iOS
      2. Setting up the Core Data Stack in AppDelegate for iOS
      3. Setting Up the Core Data Stack in AppDelegate for OS X
    6. Creating a Fetch Request in iOS
    7. Saving the Managed Object Context
      1. Saving in iOS
      2. Saving in OS X
    8. Working with NSManagedObject
      1. Creating a New NSManagedObject Instance
    9. Working with a Subclass of NSManagedObject
    10. Summary
  20. Chapter 11 : Using the Simple Database with a PHP Web Site
    1. Reviewing the Database
    2. Previewing the Web Site
    3. Implementing the PHP Web Site
      1. Looking at the Basic PHP/SQLite Structure
      2. Building the Drop-Down Selection List (phpsql1.php)
      3. Showing the Selected Data (phpsql2.php)
      4. Adding New Data (phpsql3.php)
    4. Using Try/Catch Blocks with PHP and PDO
    5. Summary
  21. Chapter 12 : Using the Simple Database with a Core Data/iOS App
    1. The Story Continues…
    2. Adjusting the Data Model and Template for Core Data
      1. Getting Rid of Keys and Revising the Data Model
      2. Changing timeStamp to name
      3. Create a New Database on Your Device or Simulator
    3. Add the Score Table and Interface to the App
      1. Making Sure You Can Add New Users with + in the Master View Controller
      2. Working with the Detail View
    4. Working with the Detail View for Score
      1. Use NSManagedObject Subclasses
      2. Use a Table View Controller for DetailViewController
      3. Modify DetailViewController Code for DetailViewController
      4. Modify MasterViewController to Pass the User to DetailViewController
    5. Summary
  22. Index

Product information

  • Title: Introducing SQLite for Mobile Developers
  • Author(s):
  • Release date: December 2015
  • Publisher(s): Apress
  • ISBN: 9781484217665