You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
315
+
Then you can create a `sqlcipher_database`.
316
+
317
+
```c++
318
+
#include<iostream>
319
+
#include<sqlite_modern_cpp/sqlcipher.h>
320
+
usingnamespacesqlite;
321
+
usingnamespacestd;
322
+
323
+
intmain() {
324
+
325
+
try {
326
+
// creates a database file 'dbfile.db' if it does not exists with password 'secret'
327
+
sqlcipher_config config;
328
+
config.key = secret;
329
+
sqlcipher_database db("dbfile.db", config);
330
+
331
+
// executes the query and creates a 'user' table
332
+
db <<
333
+
"create table if not exists user ("
334
+
" _id integer primary key autoincrement not null,"
335
+
" age int,"
336
+
" name text,"
337
+
" weight real"
338
+
");";
339
+
340
+
// More queries
341
+
342
+
db.rekey("new_secret"); // Change the password of the already encrypted database.
0 commit comments