From ed6b2a0e72e0ef33328719dc4c9d77cfd5021331 Mon Sep 17 00:00:00 2001 From: amin roosta Date: Fri, 17 Feb 2017 14:22:04 +0330 Subject: [PATCH] update readme --- README.md | 85 ++++++++++++++++++++++++++----------------------------- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 6abc41cd..e9536653 100644 --- a/README.md +++ b/README.md @@ -224,6 +224,45 @@ db << "select age,name,img from tbl where id = 2" }; ``` +SQLCipher +---- + +We have native support for [SQLCipher](https://www.zetetic.net/sqlcipher/). +If you want to use encrypted databases, include the `sqlite_moder_cpp/sqlcipher.h` header. +Then create a `sqlcipher_database` instead. + +```c++ +#include +#include +using namespace sqlite; +using namespace std; + +int main() { + + try { + // creates a database file 'dbfile.db' if it does not exists with password 'secret' + sqlcipher_config config; + config.key = secret; + sqlcipher_database db("dbfile.db", config); + + // executes the query and creates a 'user' table + db << + "create table if not exists user (" + " _id integer primary key autoincrement not null," + " age int," + " name text," + " weight real" + ");"; + + // More queries ... + db.rekey("new_secret"); // Change the password of the already encrypted database. + + // Even more queries .. + } + catch (exception& e) { cout << e.what() << endl; } +} +``` + NULL values (DEPRICATED) ---- **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++: }; ``` - NDK support ---- Just Make sure you are using the full path of your database file : `sqlite::database db("/data/data/com.your.package/dbfile.db")`. -SQLCipher ----- - -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. -Then you can create a `sqlcipher_database`. - -```c++ -#include -#include -using namespace sqlite; -using namespace std; - -int main() { - - try { - // creates a database file 'dbfile.db' if it does not exists with password 'secret' - sqlcipher_config config; - config.key = secret; - sqlcipher_database db("dbfile.db", config); - - // executes the query and creates a 'user' table - db << - "create table if not exists user (" - " _id integer primary key autoincrement not null," - " age int," - " name text," - " weight real" - ");"; - - // More queries - - db.rekey("new_secret"); // Change the password of the already encrypted database. - - // Even more queries - } - catch (exception& e) { - cout << e.what() << endl; - } -} -``` - Building and Installing ---- @@ -385,9 +382,7 @@ Note, there's nothing to make, so you there's no need to run configure and you c Breaking Changes ---- - -- Databases with non-ASCII characters in their names created with versions up to 2.4 are not found by the current master. -You have to manually rename them to their actual (UTF-8 encoded) name. +See breaking changes documented in each [Release](https://github.com/aminroosta/sqlite_modern_cpp/releases). Package managers ----