Găsiți următorul dvs. carte preferat

Deveniți un membru astăzi și citiți gratuit pentru 30 zile
Learning SQLite for iOS

Learning SQLite for iOS

Citiți previzualizarea

Learning SQLite for iOS

279 pages
2 hours
Mar 23, 2016


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.
Mar 23, 2016

Legat de Learning SQLite for iOS

Cărți conex
Articole conexe

Previzualizare carte

Learning SQLite for iOS - (Hons) Gene Da Rocha MSc BSc

Table of Contents

Learning SQLite for iOS


About the Author

About the Reviewer


eBooks, discount offers, and more

Why subscribe?


What this book covers

What you need for this book

Who this book is for


Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book




1. Introduction to SQL and SQLite

About SQL

Where does SQLite stand in today's industry?

iOS with SQLite

Embedded databases

The architecture of the SQLite database


The advantages of using SQLite

Working with SQLite

The examples of using SQLite with iOS


2. Database Design Concepts

Database essentials

Reasons for using SQLite

Database connections

Preparing queries

Parameterized SQL

Error handling

Queries within the db.exec statement

SQL injection attacks

Creating user-defined functions

Transactions and locks

Transactions – reading/writing

Designing for SQLite


3. Administering the Database

Creating a database

Creating a table

Inserting data

Selecting data

Creating an index

Exporting data

Viewing database schema data

Index data

Schema data

Backing up the database

Database tools

Database file information


4. Essentials of SQL


Query plan

SQL basics

Insert with a subselect clause

Update with a subselect clause

Select with a subselect clause

Data integrity

Default values

Constraint checking

Foreign keys

Updating Views

Index use


Synchronous writes

Database locking and deadlocks

FMDB SQLite wrapper

Database creation and opening

SQL in iOS


5. Exposing the C API

SQLite C components' functionality







Using the C API with the open database statement

Using Swift with the open database statement




The prepare statement


6. Using Swift with iOS and SQLite

Basic requirements

Starting an Xcode Project with Swift

Using the SQLite 3 Library

Using FMDB


7. iOS Development with PhoneGap and HTML5

HTML5 and PhoneGap development

An HTML5 framework

Hybrid applications

An Xcode project with PhoneGap, HTML5, and Swift


8. More Features and Advances in SQLite

PhoneGap plugins

Extensions to the C API

Write Ahead Logging with SQLite

The B-tree usage with SQLite

Creating a simple Swift



Learning SQLite for iOS

Learning SQLite for iOS

Copyright © 2016 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: March 2016

Production reference: 1180316

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78528-897-5




Gene Da Rocha, MSc, BSc (Hons)


Alvaro Franco

Ting Xiao

Acquisition Editors

Larissa Pinto

Subho Gupta

Content Development Editor

Rashmi Suvarna

Technical Editor

Anushree Arun Tendulkar

Copy Editors

Charlotte Carneiro

Yesha Gangani

Ameesha Green

Project Coordinator

Judie Jose


Safis Editing


Tejal Daruwale Soni


Abhinash Sahu

Production Coordinator

Aparna Bhagat

Cover Work

Aparna Bhagat

About the Author

Gene Da Rocha, MSc, BSc (Hons) in mobile and computer science is an experienced IT professional with over 25 years in the IT industry. He has worked for a variety of companies nationally and internationally, in different industries including corporate, start-up, pharmaceutical, finance, banking, and the NHS.

Gene is also the owner and founder of a mobile solutions company, Voxstar (www.voxstar.com), based in London and Buckinghamshire. He comes from a programming and development background, and has worked with database technology, iOS, Android, Windows mobile, and a variety of other technologies.

He has been helping and advising, programming, and recently testing software for a number of companies such as DigitasLBI, Oxfam, News UK, QAWorks, Reuters, and the Association for Project Management, among many others.

About the Reviewer

Alvaro Franco is an iOS engineer and web developer. He has contributed to the iOS and OS X open source community. He has also been a part of Aluana, building Mindrop, and companies such as Mozilla, where he contributed to delivering Firefox for iOS. Alvaro is also a motorsport fan and guitarist.

Ting Xiao, is a frontend developer focusing on how to make things good on the webpage; she is also working on the development of a mobile app simultaneously. She is interested in any brain technology. According to Ting, thanks to the technology, we can know this world much better.


eBooks, discount offers, and more

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.


Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?

Fully searchable across every book published by Packt

Copy and paste, print, and bookmark content

On demand and accessible via a web browser


SQLite is still a widely used database for mobile applications on smartphones and tablets. For those with SQL experience, it will be easier to understand and learn what it has to offer and the applications it can be used for. SQLite was released in 2000 has grown to be a well-used database for mobile device development.

Mr. D. Richard Hipp developed it on a battleship while he was at a company called General Dynamics. Initially used as storage, it was then developed using a B-tree implementation, which enhanced it and enabled the storage of rows and transactions.

This book gives you the opportunity to learn elements of SQLite, the mobile database; its interaction with the MAC operating system, Xcode; and the developer IDE for Apple apps and PhoneGap, which enables HTML5. It outlines how easy it is to work with SQLite.

What this book covers

Chapter 1, Introduction to SQL and SQLite, introduces you to the background of Structured Query Language (SQL) and the mobile database SQLite.

Chapter 2, Database Design Concepts, talks about the database concepts in SQLite.

Chapter 3, Administering the Database, introduces you to administering the SQLite database and makes you aware of the different components of this relational database.

Chapter 4, Essentials of SQL, this chapter talks about the essentials of SQL. It will outline the major possibilities with SQL and how it can be used properly on SQLite. This is essential so that you understand how SQL can be used and its limitations and advantages.

Chapter 5, Exposing the C API, deals with the C API and how you can extend its application use and produce the applications that you require using code.

Chapter 6, Using Swift with iOS and SQLite, looks at using the new programming language from Apple, Swift, with SQLite.

Chapter 7, iOS Development with PhoneGap and HTML5, looks at how to use Xcode with PhoneGap to integrate and compile with source code, including HTML5.

Chapter 8, More Features and Advances in SQLite, deals with how SQLite has changed in recent years, how it has advanced to be integrated into a variety of existing technologies, and how its simple easy-to-use formula has guaranteed its popularity with others.

What you need for this book

In this book, the software required will be the following:

Mac Operating System:

OS X 10.9 or later


Xcode IDE software development environment (version 7.0-7.1.1+) with Swift support

Latest version of PhoneGap from PhoneGap.com

Latest version of Node.js from https://nodejs.org/en/

Who this book is for

This book is intended for those who want to learn about the most powerful and flexible mobile database for developing apps in Swift or Objective-C the right way. If you are an expert Objective-C programmer or new to this platform, you'll learn quickly, grasping the code of real-world apps to use Swift effectively.


In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: This language has a variety of statements but most would recognize the INSERT, SELECT, UPDATE and DELETE statements.

A block of code is set as follows:

SELECT parameter1, STTDEV(parameter2)

FROM Table1 Group by parameter1

HAVING parameter1 > MAX(parameter3)

Any command-line input or output is written as follows:

$ sqlite3 testdatabase.db

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: Then at the bottom of the page, within the Linked Frameworks and Libraries, click on the + and a modal window will appear.


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail <feedback@packtpub.com>, and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud

Ați ajuns la sfârșitul acestei previzualizări. Înscrieți-vă pentru a citi mai multe!
Pagina 1 din 1


Ce părere au oamenii despre Learning SQLite for iOS

0 evaluări / 0 Recenzii
Ce părere aveți?
Evaluare: 0 din 5 stele

Recenziile cititorilor