Chapter 7. C Programming Interface

The sqlite3 command-line utility is designed to provide an interactive interface for end users. It is extremely useful to design and test out SQL queries, debug database files, and experiment with new features of SQLite, but it was never meant to interface with other applications. While the command-line utility can be used for very basic scripting and automated tasks, if you want to write an application that utilizes the SQLite library in any serious manner, it is expected that you’ll use a programming interface.

The native SQLite programming interface is in C, and that is the interface this chapter will cover. If you’re working in something else, there are wrappers and extensions available for many other languages, including most popular scripting languages. With the exception of the Tcl interface, all of these wrappers are provided by third parties and are not part of the SQLite product. For more information on language wrappers, see Scripting Languages and Other Interfaces.

Using the C API allows your application to interface directly with the SQLite library and the database engine. You can link a static or dynamic build of the SQLite library into your application, or simply include the amalgamation source file in your application’s build process. The best choice depends on your specific situation. See Build and Installation Options for more details.

The C API is fairly extensive, and provides full access to all of SQLite’s features. In fact, the ...

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.