Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Learning SQLite for iOS
Learning SQLite for iOS

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

Arrow left icon
Profile Icon Gene Da Rocha
Arrow right icon
NZ$48.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (4 Ratings)
Paperback Mar 2016 154 pages 1st Edition
eBook
NZ$26.99 NZ$38.99
Paperback
NZ$48.99
Subscription
Free Trial
Arrow left icon
Profile Icon Gene Da Rocha
Arrow right icon
NZ$48.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (4 Ratings)
Paperback Mar 2016 154 pages 1st Edition
eBook
NZ$26.99 NZ$38.99
Paperback
NZ$48.99
Subscription
Free Trial
eBook
NZ$26.99 NZ$38.99
Paperback
NZ$48.99
Subscription
Free Trial

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

Learning SQLite for iOS

Chapter 1. Introduction to SQL and SQLite

In this chapter, I will introduce you the Structured Query Language (SQL) and the mobile database SQLite. Whether you are an experienced technologist at SQL or a novice, using this book will help you understand this cool subject, which is gaining momentum. SQLite is a database that is used on a mobile smartphone or tablet, which is local to the device. SQLite has been modified by different vendors to harden and secure it for a variety of uses and applications.

SQLite was released in 2000 and has now grown to be de facto database on a mobile or smartphone. It is an open source piece of software with a low footprint and overheads, which is packed with a RDBMS (relational database management system).

Mr. D. Richard Hipp is the inventor and author of SQLite, which was designed and developed on a battleship while he was with a company called General Dynamics in the US Navy. The programming was built for the HP-UX operating system with Informix as the database engine. It took many hours in the data to upgrade or install the database software, and was an over-the-top database for this experienced DBA (database administrator). Mr. Hipp wanted a portable, self-contained, easy-to-use database, which could be mobile, quick to install, and not dependent on the operating system.

Initially, SQLite 1.0 used gdbm as its storage system, but later, it was replaced with its own B-tree implementation and technology for the database. The B-tree implementation was enhanced to support transactions and store rows of the data with key order. From 2001 onwards, open source family extensions for other languages, such as Java, Python, and Perl, were written to support their applications. The database and its popularity within the open source community and others started growing.

As described in Wikipedia, SQL was as follows:

Originally based upon relational algebra and tuple relational calculus, SQL consists of a data definition and manipulation language. The scope of SQL includes data insert, query, update and delete, schema creation and modification, and data access control. Although SQL is often described as, and to a great extent is, a declarative language (4GL), it also includes procedural elements.

Internationalization supported UTF-16 and UTF-8 and included text-collating sequences in versions 2 and 3 in 2004. It was funded by AOL (America Online) in 2004. It works with a variety of browsers that sometimes have in-built support for this technology. For example, there are many extensions that use Chrome or Firefox that allow you to manage the database.

There have been many features added to this product. The future with the growth in mobile phones sets this quick and easy relational database system to quantum leap, where this database's use within the mobile and tablet application space will increase.

SQLite is based on PostgreSQL as a point of reference. SQLite does not enforce any type checking. The schema does not constrain it since the type of value is dynamic, and a trigger will be activated by converting the datatype.

About SQL

In June 1970, a research paper was published by Dr. E.F. Codd called A Relational Model of Data for Large Shared Data Banks. The Association of Computer Machinery (ACM) accepted Codd's data and technology model, which has become the standard of the RDBMS today. IBM Corporation had invented the language called Structured English Query Language (SEQUEL), where the word "English" was dropped to become SQL.

SQL has become the standard for the RDMS, which is used by databases such as Oracle, Sybase, and Microsoft's SQL Server.

Today, there are American National Standards Institute (ANSI) standards for SQL, and there are many variations of this technology. Among the mentioned manufacturers, there are also others available in the open source world, for example, an SQL query engine, such as Presto.

Presto is the distribution engine for SQL under open source, which is made to execute interactive analytic queries. Presto queries are run under databases from a variety of data source sizes—gigabytes to petabytes.

Companies such as Facebook and Dropbox use the Presto SQL engine for their queries and analytics in data warehouse and related applications.

SQL is made up of data manipulation and definition language built with tuple and algebra calculation in a relational format. This language has a variety of statements but most would recognize the INSERT, SELECT, UPDATE, and DELETE statements. These statements form a part of the database schema management process and aid the data and security accesses. SQL includes procedural elements as a part of its setup.

Where does SQLite stand in today's industry?

Companies may use applications, but they are not aware of the SQL engines that drive their data storage and information. Although it had become a standard with the ANSI in 1986, SQL features and functionalities are not 100% portable among different SQL systems. They also require code changes to be useful. These standards are always up for revision to ensure that ANSI is maintained.

There are many industrial and commercial databases, such as Oracle, SQL Server, or DB2, but none of them are as flexible, light, or open source as SQLite. Although smartphones are getting more powerful, you cannot compare them to the processing power of a modern desktop or laptop. SQLite, as its names suggests, is an SQL in a light environment, which is also flexible and versatile. So, at present, the best, light, fully functional, and customized database for mobile, is SQLite.

SQLite cannot be compared to enterprise database engines, such as SQL Server, Oracle, and MySQL. These enterprise database systems provide a centralized and controlled position, whereas SQLite provides local storage on a mobile device. SQLite is effectively based on the economy of size and reliability. It is simple to use, small, robust, and does not compete with these enterprise databases.

SQLite works well with "Internet of Things" as well, because of the no-need-for-human input or administration feature. So, for applications that deal with drones, medical equipment, robots, and sensors, SQL makes an ideal candidate for usage on a variety of mobile applications.

iOS with SQLite

Out of the hundreds of thousands of apps in all the app stores, it would be difficult to find the one that does not require a database of some sort to store or handle data in a particular way. There are different formats of data and datafeeds, but they all require some sort of temporary or permanent storage. A small amount of data may not be applicable, but a medium or large amount of data will require a storage mechanism, such as a database to assist the app.

Using a database such as SQLite with iOS will enable developers to use their existing skills to run their DBMS. For SQLite, there is a C-library that is embedded and available to use with iOS with the Xcode IDE.

Apple fully supports SQLite, which uses an include statement as a part of the library call, but developers can also use FMDB, which is a cocoa/objective-C wrapper around SQLite.

A few advantages of SQLite are that it is fast, lightweight, reliable, uses existing SQL knowledge, is supported by Apple on Mac OS and iOS and by many developers, as well as being integrated without much outside involvement.

The SQLite 3 library is under the general tab once the main project name is highlighted on the left-hand side of the page. Then, at the bottom of the page, within Linked Frameworks and Libraries, click on the + for a modal window to appear. Enter the word sqlite and select the libsqlite3.dylib library, as shown in the following screenshot:

iOS with SQLite

In effect, it is the C++ wrapper, called the libsqlite3.dylib library, within the framework section that allows the API to work with SQLite commands.

Before any SQL processes can take place, the database should be opened and ready for querying, and, upon the success of data retrieval, the constant called SQLITE_OK should be set to 0.

Once the C++ wrapper is used and the access to SQLite commands is available, it is an easier process to use SQLite with iOS.

Tip

Downloading the example code

You can download the example code files for this book 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 files e-mailed directly to you.

You can download the code files by following these steps:

  • Log in or register to our website using your e-mail address and password.
  • Hover the mouse pointer on the SUPPORT tab at the top.
  • Click on Code Downloads & Errata.
  • Enter the name of the book in the Search box.
  • Select the book for which you're looking to download the code files.
  • Choose from the drop-down menu where you purchased this book from.
  • Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

Embedded databases

SQLite has been designed and developed to work and coexist with other applications and processes in its area. RDBMS is tightly integrated with the native application software that requires storing information but is masked, which is hidden from users, and it requires minimal administration or maintenance.

SQLite can work with different APIs hidden from users, and it requires minimal administration or maintenance areas.

The RDMS SQLite will also work with other applications:

  • It requires minimal supervision
  • There is no network traffic and access is faster since it is a file-based system
  • There are no network access conflicts or configurations
  • There are no access limitations with privileges or permissions
  • There is much reduced overheads

These make it easier and quicker to deploy your applications to app stores or other locations.

Figure 1, seen in this section, shows how different components work seamlessly together in a harmonized way to link up data with the SQLite library and other processes. These show how the Apache and C/C++ processes work together with the SQLite-C library to interface and link with it, so it becomes seamless and integrates with the operating system.

SQLite has been developed and integrated in such a way that it will interface and gel with a variety of applications and multiple solutions. As a lightweight RDBMS, it can stand on its own due to its versatility and is not cumbersome or too complex to benefit your application. It can be used on many platforms, and comes with a binary compatible format, which is easier to dovetail within your mobile application.

The different types of IT professionals will be involved with SQLite, since it holds the data, affects performance, and involves database design, user or mobile interface design specialists, analysts, and consultancy types. These professionals can use their existing knowledge of SQL to quickly grasp SQLite. SQLite can act as both data processor for information, or deal with data in the memory, to perform in an excellent manner.

Figure 1 also outlines how the different software pieces of a jigsaw can interface properly using the C API interface for SQLite with some other programming language code. For example, C or C++ code can be programmed to communicate with the SQLITE C API, which will then talk to the operating system and communicate with the database engine. Another language, such as PHP, can communicate using its own language data objects, which will, in turn, communicate with the SQLite C API and the database.

SQLite is a great database to learn, especially for computer scientists who want to use a tool that can open their minds to investigate caching, B-Tree structures and algorithms, database design architecture, and other concepts.

For more information of how SQLite sits within the other applications on a mobile device, see Figure 1:

Embedded databases

Figure 1: C API interface to SQLite

The architecture of the SQLite database

As a library within the OS-Interface, SQLite will have many functions implemented through a program called tclsqlite.c. Many technologies and reserved words are used in different languages, but here we have used C language. The core functions are to be found in main.c, legacy.c, and vmbeapi.c. There is also a source code file in C for the TCL language, to avoid any confusion; the prefix of sqlite3 is used at the beginning of the SQLite library.

The Tokenizer code base is found within tokenize.c. Its task is to look at the strings that are passed to it and partition or separate them into tokens, which are then passed to the parser. The tokenize.c file is included in the code with an include statement and is located in the sqlite/src/tokenize.c directory area.

The Parser code base is found within parse.y. The Lemon LALR(1) parser generator is the parser for SQLite; it takes the concept of tokens and assigns them a meaning. To keep within the low-sized footprint of RDBMS, only one C file is used for the parse generator.

The Code Generator is then used to create SQL statements from the outputted tokens of the parser. It will produce some virtual machine code that will carry out the work of SQL statements. Several files, such as attach.c, build.c, delete.c, select.c, and update.c, will handle the SQL statements and syntax.

Virtual machines execute the code that is generated from the Code Generator. It has in-built storage, where each instruction may have up to three additional operands as a part of each code. The source file is called vdbe.c, which is a part of the SQLite database library. Built in is also a computing engine that has been specially created to integrate with the database system.

There are two header files for virtual machines. The header files that interface a link between the SQLite libraries are vdbe.h and vdbeaux.c, which have utilities used by other modules. The vdbeapi.c file also connects to virtual machines with sqlite3_bind and other related interfaces. C language routines are called from SQL functions to reference them to the header files. For example, functions such as count() are defined in func.c, and date functions are located in date.c.

B-tree is a type of table implementation used in SQLite, and the C source file is btree.c. The btree.h header file defines the interface of the B-tree system. There is a different B-tree setup for every table and index held within the same file. There is a header portion within btree.c, which will have details of B-tree in a large comment field.

Pager or Page Cache using B-tree will ask for data in a fixed size format. The default size is 1024 bytes, but it can be between 512 and 65536 bytes. Commit and Rollback operations, coupled with the caching, reading, and writing of the data, are handled by Page Cache or Pager. Data locking mechanisms are also handled by Page Cache. The C file called page.c is implemented to handle requests within the SQLite library and the header file is pager.h.

The OS Interface C file is defined in os.h. It addresses how SQLite can be used on different operating systems, and it becomes transparent and portable to the user, thus becoming a valuable solution for any developer. An abstract layer to handle Win32 and POSIX compliant systems is also kept in place. Different operating systems have their own C file. For example, os_win.c is for Windows, os_unix.c is for Unix; both are coupled with their own os_win.h and os_unix.h header files.

Util.c is the C file that will handle memory allocation and string comparisons. The Utf.c C file will hold Unicode conversion subroutines.

For more information on the architecture of SQLite, see Figure 2:

The architecture of the SQLite database

Figure 2: Architecture diagram of SQLite

The Utf.c C file will hold the Unicode data, sort it within the SQL engine, and use the engine as a mechanism for computing data. Since the memory of the device is limited and the database size has the same constraints, the developer has to think outside the box to use these techniques.

These types of memory and resource management formed a part of the approach when the overlay techniques were used in the past and the disk and memory was limited:

    SELECT parameter1, STTDEV(parameter2)
      FROM Table1 Group by parameter1
      HAVING parameter1 > MAX(parameter3)

Features

As part of its standards, SQLite uses and implements most of the SQL-92 standards, but not all the potential features or parts of functionality are used or realized. For example, SQLite uses and implements most of the SQL-92 standards but not all potent columns. The support for triggers is not 100% as it cannot write output to the views.

As mentioned previously, the use of a common datatype for a column is different; most relational database systems assign them to individual values. SQLite will convert a string to an integer if the column's preferred type is an integer. It is a good piece of functionality when bound to this type of scripting language, but the technique is not portable to other RDBMS systems. It also has its criticisms for not having a good data integrity mechanism compared to others, in relation to statically typed columns.

There are some major differences between the two approaches of data: one is Core Data and the SQLite way Core Data is similar to having a layer of information between the user interface and the database itself. It does have the advantage of speeding up database interactivity read/write process and saves writing huge queries. While SQLite is a local relational database with its own efficiencies and limitations, it may not suit all applications. Sometimes, due to the speed of a device, Core Data may have the advantage of SQLite directly.

Briefly, your application will have model layer objects, and these are held and managed in a framework, namely, Core Data. It manages the life cycle of an object within iOS. This is just some background information to show how data can be read from databases and the speed at which this takes place.

The advantages of using SQLite

A few advantages of using SQLite are listed here:

  • SQLite does have a data constraints feature and can edit or drop tables without loading them into memory.
  • SQLite works on the data stored on the disk and is slower compared to Core Data.
  • Core Data, on the other hand, does not have data constraints, and can be implemented using the app's business logic instead.
  • In order to update or drop a table, the entire table has to be loaded up.
  • Core Data is quick to create records/rows but slower to save the data.
  • Core Data does have another advantage where it operates and works in the memory, and the data has to be loaded from the disk to memory.
  • Core Data works with objects based in the memory, or can be accessed using the standard slower disk method.
  • Core Data will work on non-transactional, single user, or single-threaded methods. SQLite's function is to fetch and store data using its file database system. It operates by storing the data on the disk where the data is incrementally or minimally loaded.
  • Effectively, the data can be transactional, multiuse, and thread-safe. It saves data to the disk and is mostly resilient to crashes. It is slower if you have to create hundreds of thousands of rows, but it does have data constraints, such as unique keys.
  • SQLite has bindings to many languages such as Basic, C, C#, C++, Java, JavaScript, Lua, PHP, Objective-C, Python, Ruby, and TCL. Its popularity with the open source community and usage by customers and developers has enabled its growth to continue.
  • This lightweight RDMS can be used on Google Chrome, Firefox, Safari, Opera, and Android browsers and has middleware support using ADO.NET, ODBC, COM (ActiveX), and XULRunner. It also has a support for web application frameworks, such as Django (Python based), Ruby on Rails, and Bugzilla (Mozilla). There are other applications, such as Adobe Photoshop Light and Skype that use SQLite. It is also a part of Windows 8, Symbian OS, Android, and OpenBSD operating systems.
  • Apart from not having the large overheads of other database engines, SQLite has a major enhancement, known as the EXPLAIN keyword, with its manifest typing.
  • For controlling constraint conflicts, the REPLACE and ON CONFLICT statements are used.
  • Within the same query, multiple independent databases can be accessed using the DETACH and ATTACH statements.
  • New SQL functions and collating sequences can be created using the predefined APIs, which offer much more flexibility.
  • As there is no configuration required, SQLite just does the job and works.
  • No lists, such as the REPLACE and ON CONFLICT procedures, are required.
  • There is no need to initialize, stop, restart, or start server processes, and no administrator is required to create the database with proper access controls or security permits.
  • After any failure, no user actions are required to recover the database, since it is self-repairing.
  • SQLite is more advanced than previously thought. Unlike other RDMS, it does not require a server setup via a server to serve up data or incur network traffic costs. There is no TCP/IP calls, nor frequent communication backward or forward.
  • SQLite is direct; the operating system process deals with database access to its file and controls database writes and reads with no middle-man process handshaking.
  • By having no server backend, the process of installation, configuration, or administration is reduced significantly, and access to the database is granted to programs that require this type of data operation. This is an advantage in one way, but it is also a disadvantage for security and protection from data-driven misuse, data concurrency, or data row locking mechanisms.
  • It also allows the database to be accessed several times by different applications at the same time.
  • It supports a form of portability for the cross platform database file that can be located with the database file structure. The database file can be updated on one system and copied to another on either 32 bit or 64 bit with different architectures; this does not make a difference to SQLite.
  • The usage of different architectures and the promises of developers to keep the file system stable and compatible with previous, current, and future developments will allow this database to grow and thrive. SQLite databases do not need to upload old data to new, formatted, and upgraded databases; it just works.
  • By having a single disk file for the database, the information can be copied on a USB and shared or just reused on another device very quickly by keeping all the information intact.
  • Another feature of this portable database, SQLite, is its size, which can start on a single 512-byte page and expand to 2,147,483,646 pages at 65,536 bytes per page, or in bytes 140,737,488,224,256, which equates to about 140 terabytes. Most other RDBMS are much larger, but IBM's Cloudscape is small, with a 2 MB jar file, but still larger than SQLite.
  • The Firebird alternative's client (frontend) library is about 350 KB, whereas the Berkeley Oracle database is around 450 KB, without the SQL support, and with one simple key/value pair's option.
  • This advanced portable database system and its source code is in the public domain. However, there are open source license issues and controls for some test code and documentation.
  • This is great news for developers who might want to code up new extensions or database functionality that works with their programs, which could be made into a "product extension" for SQLite.
  • You cannot have this sort of access to SQL source code around since everything has a patent, limited access, or just no access.
  • There are signed affidavits by developers to disown any copyright interest in the SQLite code. SQLite is different because it is just not governed or ruled by copyright law, which monitors the way a software should really work or be used.

Using the small allocation with variable length records, applications run faster, database access is quicker, manifest typing is used, and the database is small and nimble.

The ease of using this RDBMS makes it easier for most programmers at an intermediate level to create applications using this technology, with its detailed documentation and examples.

Other RDBMS are internally complex, with links to data structures and objects. SQLite comprises a virtual machine language that uses the EXPLAIN reserved word in front of a query.

The virtual machine has increased and benefitted this database engine by providing an excellent process or controlled environment between the backend (where the results are computed and outputted), and frontend (where the SQL is parsed and executed).

The SQL implementation language is comparable to other RDBMS, especially with its lightweight base, and it supports recursive triggers and requires the FOR/EACH ROW behavior. The FOR EACH statement is not currently supported, but functionality cannot be ruled out in the future.

As described so far in this chapter, SQLite is a nimble and easy-to-use database that developers can engage with quickly, use existing skills, and output systems to mobile devices and tablets far easier than ever before. With the help of HTML5 and other JavaScript frameworks, the advancement of SQL and number of SQLite installations will take a quantum leap.

Working with SQLite

The website for SQLite is available at www.sqlite.org, where you can download all the binaries for the database, documentation, and source code, which works on operating systems such as Linux, Windows, and MAC OS X.

The SQLite share library or DLL is the library to be used for the Windows operating system and can be installed or seen via Visual Studio with the C++ language. So, the developer can write the code using the library that is presently linked in reference via the application. When the execution has taken place, the DLL will load and all the references in the code will link to those in the DLL at the right time.

The SQLite3 command-line programCLP—is a self-contained program that has all the components to run at the command line.

It also comes with an extension for TCL. So within TCL, you can connect and update the SQLite database. SQLite downloads come with the TAR version for Unix systems, and the ZIP version for Windows systems.

The examples of using SQLite with iOS

The following is a simple application on how to use iOS with the SQLite database with Xcode. It outlines the basic steps of creating an application and database, and selecting data.

To get started, let's start Xcode and create a template using the Single View Application choice, as shown in the following screenshot:

The examples of using SQLite with iOS

Click on the Next button to proceed to the next screen in this process. In the product name field, enter SimpleCalculator for the language, and select Swift. For the devices field, select iPhone. Then, click on the Next button to move onto the next screen, as shown in the following screenshot:

The examples of using SQLite with iOS

In the following screenshot, select the directory where the code will reside. Now, we can view what the Xcode developer tool has created. Then, select a device to display the information; in our case, use the iPhone 6s.

See the directory for the source code, as shown in the following screenshot:

The examples of using SQLite with iOS

The following is a screenshot showing the SimpleCalculator application opened in Xcode. Select the iPhone 6s option as the device to develop on:

The examples of using SQLite with iOS

Next, click on the Play button that will compile and build the application as shown here in both images, and a blank screen will appear:

The examples of using SQLite with iOS

The preceding screenshot shows the application to be built, and the following screenshot shows a blank screen after the image is compiled and run.

This method gets you to the basics of an iOS application with Swift working as a canvas.

In this brief example, we will use SQLiteDB.swift and String-Extras.swift to work with the SQLite database, including the Bridging-Header.h file. In the Build Settings option, view Objective-C Bridging Header and double-click on it, and bridge it to Bridging-Header.h, and you can also drag it to show that it is linked.

As mentioned previously, add libsqlite3.0.dylib to the linked frameworks by navigating to General | Linked Frameworks and Libraries; then, add Libsqlite3.0.dylib.

Now, rebuild the project to show that it's working:

The examples of using SQLite with iOS

Click on the Simulator button, and then click on Quit to stop the current compiled simulator program. The program will compile with no problems. Next, a database instance has to be created as shown in the following code. The SQLite.DB.query method is used to execute these commands:

  • First an instance is required:
    let testdb = SQLiteDB.sharedInstance()
  • To run this query, the following code is used with the SQLiteDB.query way:
    var theresult = testdb.query("select * from people where county = 'Berks'", parameters: nil)
    for row in result
    {
        println(row["name"]!.asString())
    }
  • To delete a record for example, follow the following piece of code:
    testdb.execute("delete from people where county = 'Bucks' ", parameters: nil)

Summary

In this chapter, you read the history of SQL, the impact of relational databases, and the use of a mobile SQL database, namely, SQLite. This chapter outlined the history and beginnings of SQLite and how it has grown to be the most used database on mobile devices so far. In the next chapter, you will learn about the components of database concepts and how to design an SQLite database. The next chapter will show you the basic elements of design for an SQLite database.

Left arrow icon Right arrow icon

Key benefits

  • 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

Description

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.

Who is this book 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
Estimated delivery fee Deliver to New Zealand

Standard delivery 10 - 13 business days

NZ$20.95

Premium delivery 5 - 8 business days

NZ$74.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 23, 2016
Length: 154 pages
Edition : 1st
Language : English
ISBN-13 : 9781785288975
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Estimated delivery fee Deliver to New Zealand

Standard delivery 10 - 13 business days

NZ$20.95

Premium delivery 5 - 8 business days

NZ$74.95
(Includes tracking information)

Product Details

Publication date : Mar 23, 2016
Length: 154 pages
Edition : 1st
Language : English
ISBN-13 : 9781785288975
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just NZ$7 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just NZ$7 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total NZ$ 178.97
Learning iOS UI Development
NZ$48.99
Learning Xcode 8
NZ$80.99
Learning SQLite for iOS
NZ$48.99
Total NZ$ 178.97 Stars icon

Table of Contents

9 Chapters
1. Introduction to SQL and SQLite Chevron down icon Chevron up icon
2. Database Design Concepts Chevron down icon Chevron up icon
3. Administering the Database Chevron down icon Chevron up icon
4. Essentials of SQL Chevron down icon Chevron up icon
5. Exposing the C API Chevron down icon Chevron up icon
6. Using Swift with iOS and SQLite Chevron down icon Chevron up icon
7. iOS Development with PhoneGap and HTML5 Chevron down icon Chevron up icon
8. More Features and Advances in SQLite Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(4 Ratings)
5 star 50%
4 star 0%
3 star 0%
2 star 0%
1 star 50%
EscherOne Oct 09, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Fit in perfectly for my class and allowed me to complete project a little ahead of deadline dates.
Amazon Verified review Amazon
P McTernan May 12, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book, very well written
Amazon Verified review Amazon
Amazon Customer Feb 27, 2017
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
This was absolutely the WORST book I have ever read. The writing was horrible. It was completely unorganized and repetitive and I can honestly say there was not a single useful page in this book. It is clear that the author may be in the process of learning English as the grammar and sentence structure was almost laughable. How this ever got thru the editorial process is beyond me. I left it in the recycle bin at the airport as it wasn't even worth giving to somebody else to read. DO NOT BUY THIS BOOK. I wish you could leave a score of ZERO stars as that would be more fitting.
Amazon Verified review Amazon
Salvador Huertas Amoros Feb 19, 2024
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
No me ha gustado nada, es un timo, está escrito en dos tardes, pensando en rellenar las hojas.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela