Skip to content

Commit ed6b2a0

Browse files
committed
update readme
1 parent 3cc90bb commit ed6b2a0

File tree

1 file changed

+40
-45
lines changed

1 file changed

+40
-45
lines changed

README.md

Lines changed: 40 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,45 @@ db << "select age,name,img from tbl where id = 2"
224224
};
225225
```
226226

227+
SQLCipher
228+
----
229+
230+
We have native support for [SQLCipher](https://www.zetetic.net/sqlcipher/).
231+
If you want to use encrypted databases, include the `sqlite_moder_cpp/sqlcipher.h` header.
232+
Then create a `sqlcipher_database` instead.
233+
234+
```c++
235+
#include<iostream>
236+
#include <sqlite_modern_cpp/sqlcipher.h>
237+
using namespace sqlite;
238+
using namespace std;
239+
240+
int main() {
241+
242+
try {
243+
// creates a database file 'dbfile.db' if it does not exists with password 'secret'
244+
sqlcipher_config config;
245+
config.key = secret;
246+
sqlcipher_database db("dbfile.db", config);
247+
248+
// executes the query and creates a 'user' table
249+
db <<
250+
"create table if not exists user ("
251+
" _id integer primary key autoincrement not null,"
252+
" age int,"
253+
" name text,"
254+
" weight real"
255+
");";
256+
257+
// More queries ...
258+
db.rekey("new_secret"); // Change the password of the already encrypted database.
259+
260+
// Even more queries ..
261+
}
262+
catch (exception& e) { cout << e.what() << endl; }
263+
}
264+
```
265+
227266
NULL values (DEPRICATED)
228267
----
229268
**Note: this option is deprecated and will be removed in future versions.**
@@ -324,53 +363,11 @@ To extend SQLite with custom functions, you just implement them in C++:
324363
};
325364
```
326365
327-
328366
NDK support
329367
----
330368
Just Make sure you are using the full path of your database file :
331369
`sqlite::database db("/data/data/com.your.package/dbfile.db")`.
332370
333-
SQLCipher
334-
----
335-
336-
The library has native support for [SQLCipher](https://www.zetetic.net/sqlcipher/). If you want to use encrypted databases, you have to include the `sqlite_moder_cpp/sqlcipher.h` header.
337-
Then you can create a `sqlcipher_database`.
338-
339-
```c++
340-
#include<iostream>
341-
#include <sqlite_modern_cpp/sqlcipher.h>
342-
using namespace sqlite;
343-
using namespace std;
344-
345-
int main() {
346-
347-
try {
348-
// creates a database file 'dbfile.db' if it does not exists with password 'secret'
349-
sqlcipher_config config;
350-
config.key = secret;
351-
sqlcipher_database db("dbfile.db", config);
352-
353-
// executes the query and creates a 'user' table
354-
db <<
355-
"create table if not exists user ("
356-
" _id integer primary key autoincrement not null,"
357-
" age int,"
358-
" name text,"
359-
" weight real"
360-
");";
361-
362-
// More queries
363-
364-
db.rekey("new_secret"); // Change the password of the already encrypted database.
365-
366-
// Even more queries
367-
}
368-
catch (exception& e) {
369-
cout << e.what() << endl;
370-
}
371-
}
372-
```
373-
374371
Building and Installing
375372
----
376373
@@ -385,9 +382,7 @@ Note, there's nothing to make, so you there's no need to run configure and you c
385382

386383
Breaking Changes
387384
----
388-
389-
- Databases with non-ASCII characters in their names created with versions up to 2.4 are not found by the current master.
390-
You have to manually rename them to their actual (UTF-8 encoded) name.
385+
See breaking changes documented in each [Release](https://github.com/aminroosta/sqlite_modern_cpp/releases).
391386

392387
Package managers
393388
----

0 commit comments

Comments
 (0)