Skip to content

Repository files navigation

CSQLite

SQLite packaged for the Swift Package Manager.

The package contains the SQLite amalgamation built using the recommended compile-time options.

The default build configuration includes the carray extension, FTS5 extension, built-in SQL math functions, percentile extension, R*Tree index extension, database snapshots, sqlite_stmt table, and sqlite_stat4 table.

Additionally, the decimal, ieee754, series, sha3, and uuid extensions are statically linked.

The package also includes shims for various C functions not easily accessible from Swift.

Customization

For Swift 6.1 and later the build configuration and features may be customized using package traits.

Compile-Time Options

The following traits are used to specify the build configuration and the defaults reflect the SQLite recommended compile-time options:

Package TraitDefaultSQLite Compile-Time Option
DQS_0YSQLITE_DQS=0
DQS_1SQLITE_DQS=1
DQS_2SQLITE_DQS=2
DQS_3SQLITE_DQS=3
THREADSAFE_0YSQLITE_THREADSAFE=0
THREADSAFE_1SQLITE_THREADSAFE=1
THREADSAFE_2SQLITE_THREADSAFE=2
DEFAULT_MEMSTATUS_0YSQLITE_DEFAULT_MEMSTATUS=0
DEFAULT_WAL_SYNCHRONOUS_1YSQLITE_DEFAULT_WAL_SYNCHRONOUS=1
LIKE_DOESNT_MATCH_BLOBSYSQLITE_LIKE_DOESNT_MATCH_BLOBS
MAX_EXPR_DEPTH_0YSQLITE_MAX_EXPR_DEPTH=0
OMIT_DECLTYPEYSQLITE_OMIT_DECLTYPE
OMIT_DEPRECATEDYSQLITE_OMIT_DEPRECATED
OMIT_PROGRESS_CALLBACKYSQLITE_OMIT_PROGRESS_CALLBACK
OMIT_SHARED_CACHEYSQLITE_OMIT_SHARED_CACHE
USE_ALLOCASQLITE_USE_ALLOCA
OMIT_AUTOINITYSQLITE_OMIT_AUTOINIT
STRICT_SUBTYPE_1YSQLITE_STRICT_SUBTYPE=1

Important

The DQS_ traits are mutually exclusive and only one should be specified.

The SQLite default is SQLITE_DQS=3 but the SQLite recommended value is SQLITE_DQS=0.

Important

The THREADSAFE_ traits are mutually exclusive and only one should be specified.

The SQLite default is SQLITE_THREADSAFE=1 but the SQLite recommended value is SQLITE_THREADSAFE=0.

Features

The following traits enable commonly-used SQLite features:

Package TraitDefaultSQLite Feature
ENABLE_BYTECODE_VTABSQLITE_ENABLE_BYTECODE_VTAB
ENABLE_CARRAYYSQLITE_ENABLE_CARRAY
ENABLE_COLUMN_METADATASQLITE_ENABLE_COLUMN_METADATA
ENABLE_DBPAGE_VTABSQLITE_ENABLE_DBPAGE_VTAB
ENABLE_DBSTAT_VTABSQLITE_ENABLE_DBSTAT_VTAB
ENABLE_FTS4SQLITE_ENABLE_FTS4
ENABLE_FTS5YSQLITE_ENABLE_FTS5
ENABLE_GEOPOLYSQLITE_ENABLE_GEOPOLY
ENABLE_MATH_FUNCTIONSYSQLITE_ENABLE_MATH_FUNCTIONS
ENABLE_NORMALIZESQLITE_ENABLE_NORMALIZE
ENABLE_PERCENTILEYSQLITE_ENABLE_PERCENTILE
ENABLE_PREUPDATE_HOOKSQLITE_ENABLE_PREUPDATE_HOOK
ENABLE_RTREEYSQLITE_ENABLE_RTREE
ENABLE_SESSIONSQLITE_ENABLE_SESSION
ENABLE_SNAPSHOTYSQLITE_ENABLE_SNAPSHOT
ENABLE_STMTVTABYSQLITE_ENABLE_STMTVTAB
ENABLE_STAT4YSQLITE_ENABLE_STAT4

Note

The ENABLE_SESSION trait also sets the ENABLE_PREUPDATE_HOOK trait.

License

SQLite is in the public domain.

About

SQLite packaged for the Swift Package Manager.

Topics

Resources

Stars

28 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages