Small. Fast. Reliable.
Choose any three.
In its default configuration, SQLite API routines return one of 26 integer result codes described at result-codes. However, experience has shown that many of these result codes are too course-grained. They do not provide as much information about problems as users might like. In an effort to address this, newer versions of SQLite (version 3.3.8 and later) include support for additional result codes that provide more detailed information about errors. The extended result codes are enabled (or disabled) for each database connection using the sqlite3_extended_result_codes() API.

We expect the number of extended result codes will be expand over time. Software that uses extended result codes should expect to see new result codes in future releases of SQLite.

You can get the codes like this assuming res contains a result:

  #define RESULT_CODE(res)             ((res)&0xff)
  #define EXTENDED_RESULT_CODE(res)    ((res)&~0xff)

The symbolic name for an extended result code always contains a related primary result code as a prefix. Primary result codes contain a single "" character. Extended result codes contain two or more "" characters. The numeric value of an extended result code can be converted to its corresponding primary result code by masking off the lower 8 bits.

A complete list of available extended result codes and details about the meaning of the various extended result codes can be found by consulting the C code, especially the sqlite3.h header file and its antecedent sqlite.h.in.

As of 3.3.8, this is the list:

  #define SQLITE_IOERR_READ          (SQLITE_IOERR | (1<<8))
  #define SQLITE_IOERR_SHORT_READ    (SQLITE_IOERR | (2<<8))
  #define SQLITE_IOERR_WRITE         (SQLITE_IOERR | (3<<8))
  #define SQLITE_IOERR_FSYNC         (SQLITE_IOERR | (4<<8))
  #define SQLITE_IOERR_DIR_FSYNC     (SQLITE_IOERR | (5<<8))
  #define SQLITE_IOERR_TRUNCATE      (SQLITE_IOERR | (6<<8))
  #define SQLITE_IOERR_FSTAT         (SQLITE_IOERR | (7<<8))
  #define SQLITE_IOERR_UNLOCK        (SQLITE_IOERR | (8<<8))
  #define SQLITE_IOERR_RDLOCK        (SQLITE_IOERR | (9<<8))