diff options
author | Thomas Winget <tewinget@gmail.com> | 2014-10-13 18:52:45 -0400 |
---|---|---|
committer | warptangent <warptangent@inbox.com> | 2015-01-04 18:41:44 -0800 |
commit | 90d6f8bf62bca97dc911b30505252becd8ef7520 (patch) | |
tree | b87d425251db5171dd66f7a83e8f009ead72b176 /external/glim/test_sqlite.cc | |
parent | update new blockchain to build with new changes (diff) | |
download | monero-90d6f8bf62bca97dc911b30505252becd8ef7520.tar.xz |
Adding libglim as an external library
libglim is an Apache-licensed C++ wrapper for lmdb, and rather than
rolling our own it seems prudent to use it.
Note: lmdb is not included in it, and unless something happens as did
with libunbound, should be installed via each OS' package manager or
equivalent.
Diffstat (limited to '')
-rw-r--r-- | external/glim/test_sqlite.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/external/glim/test_sqlite.cc b/external/glim/test_sqlite.cc new file mode 100644 index 000000000..726244875 --- /dev/null +++ b/external/glim/test_sqlite.cc @@ -0,0 +1,18 @@ + +#include "sqlite.hpp" +#define S(cstr) (std::pair<char const*, int> (cstr, sizeof (cstr) - 1)) +#include <assert.h> +#include <iostream> +using namespace glim; + +int main () { + std::cout << "Testing sqlite.hpp ... " << std::flush; + Sqlite sqlite (":memory:"); + SqliteSession sqs (&sqlite); + assert (sqs.query ("CREATE TABLE test (t TEXT, i INTEGER)") .ustep() == 0); + assert (sqs.query ("INSERT INTO test VALUES (?, ?)") .bind (1, S("foo")) .bind (2, 27) .ustep() == 1); + assert (sqs.query ("SELECT t FROM test") .qstep() .stringAt (1) == "foo"); + assert (sqs.query ("SELECT i FROM test") .qstep() .intAt (1) == 27); + std::cout << "pass." << std::endl; + return 0; +} |