# fnc12/sqlite_orm

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/fnc12-sqlite-orm).**

2,670 stars · 344 forks · C++ · AGPL-3.0

## Links

- GitHub: https://github.com/fnc12/sqlite_orm
- awesome-repositories: https://awesome-repositories.com/repository/fnc12-sqlite-orm.md

## Topics

`cplusplus` `cplusplus-14` `cpp` `crud` `modern-cpp` `orm` `sql` `sqlite` `sqlite-orm` `sqlite3` `sqlite3-database` `sqliteorm`

## Description

This project is a header-only C++ library that provides an object-relational mapping layer for SQLite databases. It enables developers to map native class structures directly to database tables, facilitating type-safe data persistence and retrieval without the need for raw query strings.

The library distinguishes itself through the use of template-based metaprogramming, which allows for compile-time schema mapping and query construction. By utilizing a fluent interface, it translates method calls into optimized database statements, while its support for prepared statement caching minimizes parsing overhead for repetitive operations. The system also includes automated schema synchronization to ensure that database structures remain consistent with application object definitions.

Beyond core mapping, the library provides a comprehensive suite of database management capabilities, including support for relational joins, aggregate data calculations, and atomic transaction management. It accommodates both persistent storage and volatile, in-memory database configurations. A command-line utility is also provided to assist with project distribution by merging source and header files into consolidated outputs.

## Tags

### Data & Databases

- [Object-Relational Mapping](https://awesome-repositories.com/f/data-databases/object-relational-mapping.md) — Maps C++ classes to SQLite tables for type-safe CRUD operations without raw SQL.
- [SQLite ORMs](https://awesome-repositories.com/f/data-databases/sqlite-orms.md) — Provides a header-only C++ object-relational mapping library specifically optimized for SQLite database persistence.
- [CRUD Operations](https://awesome-repositories.com/f/data-databases/crud-operations.md) — Provides type-safe interfaces for performing create, read, update, and delete operations on database records. ([source](https://github.com/fnc12/sqlite_orm/blob/master/TODO.md))
- [Object-Relational Mappers](https://awesome-repositories.com/f/data-databases/database-orms/fluent-query-builders/object-relational-mappers.md) — Synchronizes database schema definitions with application class structures to enable type-safe persistence and fluent query construction.
- [Fluent Query Builders](https://awesome-repositories.com/f/data-databases/fluent-query-builders.md) — Implements a fluent, chainable interface for constructing complex database queries at compile time.
- [Query Filters](https://awesome-repositories.com/f/data-databases/query-sorting/query-filters.md) — Enables complex data retrieval with fluent filtering, grouping, and ordering without raw SQL. ([source](https://github.com/fnc12/sqlite_orm/tree/master))
- [Schema Synchronizers](https://awesome-repositories.com/f/data-databases/schema-synchronizers.md) — Synchronizes database structures with native object definitions to maintain schema consistency. ([source](https://github.com/fnc12/sqlite_orm/blob/master/TODO.md))
- [Type-Safe Object-Relational Mappers](https://awesome-repositories.com/f/data-databases/type-safe-object-relational-mappers.md) — Binds database columns to native language members to ensure type-safe data persistence and retrieval.
- [Aggregate Calculations](https://awesome-repositories.com/f/data-databases/aggregate-calculations.md) — Supports built-in aggregate calculations like sums, averages, and counts directly within database queries. ([source](https://github.com/fnc12/sqlite_orm/blob/master/README.md))
- [Transactional Updates](https://awesome-repositories.com/f/data-databases/data-update-apis/transactional-updates.md) — Ensures transactional integrity by grouping operations into atomic units for reliable state updates.
- [Prepared Statement Engines](https://awesome-repositories.com/f/data-databases/database-drivers/prepared-statement-engines.md) — Optimizes database performance by caching prepared statements to minimize parsing overhead.
- [Atomic Transactions](https://awesome-repositories.com/f/data-databases/database-management-systems/database-systems-management/connection-transaction-management/atomic-transactions.md) — Provides atomic transaction management to ensure data consistency through commit and rollback mechanisms.
- [Database Query Joins](https://awesome-repositories.com/f/data-databases/database-query-joins.md) — Supports relational joins by referencing mapped classes directly within database queries. ([source](https://github.com/fnc12/sqlite_orm/tree/dev))
- [Database Transaction Management](https://awesome-repositories.com/f/data-databases/database-transaction-management.md) — Manages database transactions by grouping operations into atomic units with commit and rollback capabilities. ([source](https://github.com/fnc12/sqlite_orm#readme))
- [Type-Safe Query Construction](https://awesome-repositories.com/f/data-databases/expression-based-data-querying/fluent-query-apis/sql-syntax-tree-construction/fluent-query-construction/type-safe-query-construction.md) — Facilitates advanced relational querying with joins and aggregations using type-safe C++ syntax.
- [In-Memory Databases](https://awesome-repositories.com/f/data-databases/in-memory-databases.md) — Supports volatile, in-memory database configurations for temporary, high-performance data storage. ([source](https://github.com/fnc12/sqlite_orm/tree/dev))
- [Prepared Statement Interfaces](https://awesome-repositories.com/f/data-databases/prepared-statement-interfaces.md) — Executes strongly-typed, pre-compiled database statements to improve performance and security. ([source](https://github.com/fnc12/sqlite_orm/blob/master/README.md))
- [SQL Data Access Layers](https://awesome-repositories.com/f/data-databases/sql-data-access-layers.md) — Provides a type-safe abstraction layer that maps database tables to native C++ data structures for query execution.

### Development Tools & Productivity

- [Template Metaprogramming](https://awesome-repositories.com/f/development-tools-productivity/build-tooling/build-time-tooling/template-metaprogramming.md) — Uses template metaprogramming to map native classes to database schemas at compile time.
