Appendix E. C Interface Reference

This appendix lists the C library functions that can be used to communicate with a SQLite database.

The Core API

The core interface to the SQLite library is considered to be just three functions that allow you to open and close a database and to execute a query using a user-defined callback function. In this section we'll also look at the error codes returned from the core API.

Opening and Closing a Database

You can open and close a database as follows:

sqlite *sqlite_open(
  const char *dbname,
  int mode,
  char **errmsg
);

void sqlite_close(sqlite *db);

The return value of sqlite_open() and the argument to sqlite_close() is an opaque sqlite data structure.

typedef struct sqlite sqlite;

Executing a Query

You can execute ...

Get 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.