Skip to content

Commit acdd4b5

Browse files
authored
Update README.md
1 parent 82ec824 commit acdd4b5

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@ However, SQLite is written in C, and even though it exposes a [C++ API](https://
99

1010
This library is inspired by the approach other languages and frameworks take against the problem of data persistence. Specifically, in C# the [Entity Framework](https://en.wikipedia.org/wiki/Entity_Framework) allows the programmer to focus on modelling the domain, while delegating the responsibility of database management, table allocation and naming, member type annotation and naming and so on, to EF. In Swift the feature of [keypaths](https://developer.apple.com/documentation/swift/keypath) allows the programmer to write safe code, which is checked at compile time. Its predecessor Objective-C has used keypaths extensively in the [Core Data](https://developer.apple.com/documentation/coredata) Framework, which is Apple's database management software stack, using primarily SQLite in the background.
1111

12+
There are several C++ SQLite ORM libraries out there, however with the following limitations
13+
* fully detailed exposure of the underlying SQL syntax and database operations
14+
* API heavily relying on strings, so no compile-time safety can be guaranteed
15+
* inappropriate license model for closed-source or proprietary software
16+
1217
The primary goals of this library are
13-
* a native C++ API for object persistence, which feels "at home" for C++ programmers
18+
* native C++ API for object persistence, which feels "at home" for C++ programmers
1419
* safe code, checked at compile time, without the need to write raw SQL queries
1520
* automatic record registration for all types used in the program, without any additional setup
16-
* a safe and easy API for all CRUD (Create, Read, Update, Delete) operations
21+
* safe and easy to use API for all CRUD (Create, Read, Update, Delete) operations
22+
* MIT license to use for any kind of software; open source or closed source/commercial.
1723

1824
## Detailed design
1925
### Model domain record types and their members
@@ -197,6 +203,16 @@ db.Delete<Person>(&age_match_predicate);
197203
// db.Delete<Person>(5);
198204
```
199205

206+
### Raw SQL queries
207+
If you want the full SQL syntax power at your fingertips, you could try the string-based raw SQL API
208+
```c++
209+
// assume some persons have been stored in the database
210+
const auto& db = Database::Instance();
211+
212+
// execute a raw SQL query; this one will delete all persons whose name is shorter or equal than 4 characters long
213+
db.Sql("DELETE FROM Person WHERE length(first_name) <= 4");
214+
```
215+
200216
## Compilation (Cmake)
201217
### Dependencies
202218
* CMake >= 3.14

0 commit comments

Comments
 (0)