From 701de7a5a0890003ccd9ce0ba6eff322ed791009 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 24 Mar 2017 00:18:56 +0100 Subject: Update README.md --- README.md | 56 +++++++++++++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index d45d7d7..440e15a 100644 --- a/README.md +++ b/README.md @@ -18,35 +18,33 @@ Example **test.cpp** -```C++ -#include -#include -#include - -int main(int argc, char** argv) { - sqlitepp::Database database("/path/to/database.sqlite"); - database.execute("CREATE TABLE test (id, value);"); - std::shared_ptr statement = database.prepare( - "INSERT INTO test (id, value) VALUES (:id, :value);"); - statement->bind(":id", 1); - statement->bind(":value", "test value"); - statement->execute(); - statement = database.prepare("SELECT id, value FROM test;"); - ResultSet resultSet = statement->execute(); - while (resultSet.canRead()) { - std::cout << "ID: " << resultSet.readInt(0) << "\t value: " - << resultSet.readString(1) << std::endl; - resultSet.next(); - } -} -``` - -``` -$ g++ --std=c++11 -o test -lsqlitepp -lsqlite3 test.cpp -$ ./test -ID: 1 value: test value -``` + #include + #include + #include + + int main(int argc, char** argv) { + sqlitepp::Database database("/path/to/database.sqlite"); + database.execute("CREATE TABLE test (id, value);"); + std::shared_ptr statement = database.prepare( + "INSERT INTO test (id, value) VALUES (:id, :value);"); + statement->bind(":id", 1); + statement->bind(":value", "test value"); + statement->execute(); + statement = database.prepare("SELECT id, value FROM test;"); + ResultSet resultSet = statement->execute(); + while (resultSet.canRead()) { + std::cout << "ID: " << resultSet.readInt(0) << "\t value: " + << resultSet.readString(1) << std::endl; + resultSet.next(); + } + } + +Compile and run with: + + $ g++ --std=c++11 -o test -lsqlitepp -lsqlite3 test.cpp + $ ./test + ID: 1 value: test value For more information, see the [API documentation][api]. -[api]: http://robinkrahl.github.io/sqlitepp/ +[api]: https://code.ireas.org/sqlitepp/doc/ -- cgit v1.2.3