O'Reilly logo

Using SQLite by Jay A. Kreibich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Utility Functions

The SQLite library contains a number of utility functions that are useful for both application developers, and those working on SQLite extensions. Most of these are not required for basic database tasks, but if your code is strongly tied to SQLite, you may find these particularly useful.

Version Management

There are several functions available to query the version of the SQLite library. Each API call has a corresponding #define macro that declares the same value.

SQLITE_VERSION const char* sqlite3_libversion( )

Returns the SQLite library version as a UTF-8 string.

SQLITE_VERSION_NUMBER int sqlite3_libversion_number( )

Returns the SQLite library version as an integer. The format is MNNNPPP, where M is the major version (3, in this case), N is the minor number, and P is the point release. This format allows for releases up to 3.999.999. If a sub-point release is made, it will not be indicated in this version number.

SQLITE_SOURCE_ID const char* sqlite3_sourceid( )

Returns the check-in stamp of the code used in this release. The string consists of a date, time stamp, and an SHA1 hash of the source from the source repository.

If you’re building your own application, you can use the #define macros and the function calls to verify that you’re using the correct header for the available library. The #define values come from the header file, and are set when your application is compiled. The function calls return the same values that were baked into the library when it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required