Using Sqlite

E-Book Overview

Application developers, take note: databases aren't just for the IS group any more. You can build database-backed applications for the desktop, Web, embedded systems, or operating systems without linking to heavy-duty client-server databases such as Oracle and MySQL. This book shows you how to use SQLite, a small and lightweight relational database engine that you can build directly into your application.With SQLite, you'll discover how to develop a database-backed application that remains manageable in size and complexity. This book guides you every step of the way. You'll get a crash course in data modeling, become familiar with SQLite's dialect of the SQL database language, and much more.Learn how to maintain localized storage in a single file that requires no configuration Build your own SQLite library or use a precompiled distribution in your application Get a primer on SQL, and learn how to use several language functions and extensions Work with SQLite using a scripting language or a C-based language such as C# or Objective-C Understand the basics of database design, and learn how to transfer what you already know to SQLite Take advantage of virtual tables and modules "Complex SQL concepts explained clearly." --D. Richard Hipp, creator of SQLite

E-Book Content

Using SQLite Using SQLite Jay A. Kreibich Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo Using SQLite by Jay A. Kreibich Copyright © 2010 Jay A. Kreibich. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or [email protected] Editor: Mike Loukides Production Editor: Kristen Borg Proofreader: Kiel Van Horn Indexer: Lucie Haskins Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Robert Romano Printing History: August 2010: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Using SQLite, the image of a great white heron, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. ISBN: 978-0-596-52118-9 [M] 1281104401 To my Great-Uncle Albert “Unken Al” Kreibich. 1918–1994 He took a young boy whose favorite question was “why?” and taught him to ask the question “how?” (Who also—much to the dismay of his parents and the kitchen telephone—taught him the joy of answering that question, especially if it involved pliers or screwdrivers.) —jk Table of Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv 1. What Is SQLite? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Self-Contained, No Server Required Single File Database Zero Configuration Embedded Device Support Unique Features Compa