Skip to Content
Beginning iOS 5 Application Development
book

Beginning iOS 5 Application Development

by Wei-Meng Lee
January 2012
Beginner content levelBeginner
655 pages
16h 35m
English
Wrox
Content preview from Beginning iOS 5 Application Development

SUMMARY

This chapter provided a brief introduction to the SQLite3 database used in the iPhone. With SQLite3, you can now store all your structured data in an efficient manner and perform complex aggregations on your data. To learn more about SQLite, visit its official page at www.sqlite.org.

EXERCISES

  1. Explain the difference between the sqlite3_exec() function and the three functions sqlite3_prepare(), sqlite3_step(), and sqlite3_finalize().
  2. How do you obtain a C-style string from an NSString object?
  3. Write the code segment to retrieve a set of rows from a table.

    Answers to the exercises can be found in Appendix D.

image WHAT YOU LEARNED IN THIS CHAPTER

TOPIC KEY CONCEPTS
Using a SQLite3 database in your application Add a reference to the libsqlite3.dylib library to your project.
Obtaining a C-style string from an NSString object Use the UTF8String method of the NSString class.
Creating and opening a SQLite3 database Use the sqlite3_open() C function.
Executing a SQL query Use the sqlite3_exec() C function.
Closing a database connection Use the sqlite3_close() C function.
Using bind variables Create a sqlite3_stmt object.

Use the sqlite3_prepare_v2() C function to prepare the statement.

Use the sqlite3_bind_text() (or sqlite3_bind_int(), and so on) C function to insert the values into the statement.

Use the sqlite3_step() C function to execute the statement.

Use the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering iOS 12 Programming - Third Edition

Mastering iOS 12 Programming - Third Edition

Donny Wals
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer

Publisher Resources

ISBN: 9781118144251Purchase book