diff --git a/src/util/sqlite3-statement.cpp b/src/util/sqlite3-statement.cpp
new file mode 100644
index 0000000..243088b
--- /dev/null
+++ b/src/util/sqlite3-statement.cpp
@@ -0,0 +1,115 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2015 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "sqlite3-statement.hpp"
+
+#include <sqlite3.h>
+
+namespace ndn {
+namespace util {
+
+Sqlite3Statement::~Sqlite3Statement()
+{
+  sqlite3_finalize(m_stmt);
+}
+
+Sqlite3Statement::Sqlite3Statement(sqlite3* database, const std::string& statement)
+{
+  int res = sqlite3_prepare_v2(database, statement.c_str(), -1, &m_stmt, nullptr);
+  if (res != SQLITE_OK)
+    throw std::domain_error("bad SQL statement: " + statement);
+}
+
+int
+Sqlite3Statement::bind(int index, const char* value, size_t size, void(*destructor)(void*))
+{
+  return sqlite3_bind_text(m_stmt, index, value, size, destructor);
+}
+
+int
+Sqlite3Statement::bind(int index, const std::string& value, void(*destructor)(void*))
+{
+  return sqlite3_bind_text(m_stmt, index, value.c_str(), value.size(), destructor);
+}
+
+int
+Sqlite3Statement::bind(int index, const void* buf, size_t size, void(*destructor)(void*))
+{
+  return sqlite3_bind_blob(m_stmt, index, buf, size, destructor);
+}
+
+int
+Sqlite3Statement::bind(int index, const Block& block, void(*destructor)(void*))
+{
+  return sqlite3_bind_blob(m_stmt, index, block.wire(), block.size(), destructor);
+}
+
+int
+Sqlite3Statement::bind(int index, int number)
+{
+  return sqlite3_bind_int(m_stmt, index, number);
+}
+
+std::string
+Sqlite3Statement::getString(int column)
+{
+  return std::string(reinterpret_cast<const char*>(sqlite3_column_text(m_stmt, column)),
+                     sqlite3_column_bytes(m_stmt, column));
+}
+
+Block
+Sqlite3Statement::getBlock(int column)
+{
+  return Block(sqlite3_column_blob(m_stmt, column), sqlite3_column_bytes(m_stmt, column));
+}
+
+int
+Sqlite3Statement::getInt(int column)
+{
+  return sqlite3_column_int(m_stmt, column);
+}
+
+
+const uint8_t*
+Sqlite3Statement::getBlob(int column)
+{
+  return static_cast<const uint8_t*>(sqlite3_column_blob(m_stmt, column));
+}
+
+int
+Sqlite3Statement::getSize(int column)
+{
+  return sqlite3_column_bytes(m_stmt, column);
+}
+
+int
+Sqlite3Statement::step()
+{
+  return sqlite3_step(m_stmt);
+}
+
+Sqlite3Statement::operator sqlite3_stmt*()
+{
+  return m_stmt;
+}
+
+} // namespace util
+} // namespace ndn
diff --git a/src/util/sqlite3-statement.hpp b/src/util/sqlite3-statement.hpp
new file mode 100644
index 0000000..dbad1d2
--- /dev/null
+++ b/src/util/sqlite3-statement.hpp
@@ -0,0 +1,158 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2015 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_UTIL_SQLITE3_STATEMENT_HPP
+#define NDN_UTIL_SQLITE3_STATEMENT_HPP
+
+#include "../encoding/block.hpp"
+#include <string>
+
+struct sqlite3;
+struct sqlite3_stmt;
+
+namespace ndn {
+namespace util {
+
+/**
+ * @brief wrap an SQLite3 prepared statement
+ * @warning This class is implementation detail of ndn-cxx library.
+ */
+class Sqlite3Statement : noncopyable
+{
+public:
+  /**
+   * @brief initialize and prepare Sqlite3 statement
+   * @param database handler to open sqlite3 database
+   * @param statement SQL statement
+   * @throw std::domain_error SQL statement is bad
+   */
+  Sqlite3Statement(sqlite3* database, const std::string& statement);
+
+  /**
+   * @brief finalize the statement
+   */
+  ~Sqlite3Statement();
+
+  /**
+   * @brief bind a string to the statement
+   *
+   * @param index The binding position
+   * @param value The pointer of the binding string
+   * @param value The size of the binding string
+   * @param destructor SQLite3 destructor, e.g., SQLITE_TRANSIENT
+   * @return SQLite result value.
+   */
+  int
+  bind(int index, const char* value, size_t size, void(*destructor)(void*));
+
+  /**
+   * @brief bind a string to the statement
+   *
+   * @param index The binding position
+   * @param value The binding string
+   * @param destructor SQLite3 destructor, e.g., SQLITE_TRANSIENT
+   * @return SQLite result value.
+   */
+  int
+  bind(int index, const std::string& value, void(*destructor)(void*));
+
+  /**
+   * @brief bind a byte blob to the statement
+   *
+   * @param index The binding position
+   * @param value The pointer of the blob
+   * @param value The size of the blob
+   * @param destructor SQLite3 destructor, e.g., SQLITE_TRANSIENT
+   * @return SQLite result value.
+   */
+  int
+  bind(int index, const void* value, size_t size, void(*destructor)(void*));
+
+  /**
+   * @brief bind a byte blob to the statement
+   *
+   * @param index The binding position
+   * @param block The binding block
+   * @param destructor SQLite3 destructor, e.g., SQLITE_TRANSIENT
+   * @return SQLite result value
+   */
+  int
+  bind(int index, const Block& block, void(*destructor)(void*));
+
+  /**
+   * @brief bind an integer to the statement
+   *
+   * @param index The binding position
+   * @param number The binding integer
+   * @return SQLite result value
+   */
+  int
+  bind(int index, int number);
+
+  /**
+   * @brief get a string from @p column.
+   */
+  std::string
+  getString(int column);
+
+  /**
+   * @brief get a block from @p column.
+   */
+  Block
+  getBlock(int column);
+
+  /**
+   * @brief get an integer from @p column.
+   */
+  int
+  getInt(int column);
+
+  /**
+   * @brief get a pointer of byte blob from @p column.
+   */
+  const uint8_t*
+  getBlob(int column);
+
+  /**
+   * @brief get the size of @p column.
+   */
+  int
+  getSize(int column);
+
+  /**
+   * @brief wrapper of sqlite3_step
+   */
+  int
+  step();
+
+  /**
+   * @brief implicitly converts to sqlite3_stmt* to be used in SQLite C API
+   */
+  operator sqlite3_stmt*();
+
+private:
+  sqlite3_stmt* m_stmt;
+};
+
+} // namespace util
+} // namespace ndn
+
+#endif // NDN_UTIL_SQLITE3_STATEMENT_HPP
diff --git a/tests/unit-tests/util/sqlite3-statement.t.cpp b/tests/unit-tests/util/sqlite3-statement.t.cpp
new file mode 100644
index 0000000..a7fa29a
--- /dev/null
+++ b/tests/unit-tests/util/sqlite3-statement.t.cpp
@@ -0,0 +1,156 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2015 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "util/sqlite3-statement.hpp"
+
+#include <boost/filesystem.hpp>
+#include "boost-test.hpp"
+
+#include <sqlite3.h>
+
+namespace ndn {
+namespace util {
+namespace tests {
+
+class Sqlite3StatementTestFixture
+{
+public:
+  Sqlite3StatementTestFixture()
+    : m_path(boost::filesystem::path(UNIT_TEST_CONFIG_PATH))
+  {
+    boost::filesystem::create_directories(m_path);
+    int result = sqlite3_open_v2((m_path / "sqlite3-statement.db").string().c_str(), &db,
+                                 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
+#ifdef NDN_CXX_DISABLE_SQLITE3_FS_LOCKING
+                                 "unix-dotfile"
+#else
+                                 nullptr
+#endif
+                                 );
+
+    if (result != SQLITE_OK) {
+      BOOST_FAIL("Sqlite3 database cannot be opened/created: " + m_path.string());
+    }
+  }
+
+  ~Sqlite3StatementTestFixture()
+  {
+    sqlite3_close(db);
+    boost::filesystem::remove_all(m_path);
+  }
+
+private:
+  boost::filesystem::path m_path;
+
+public:
+  sqlite3* db;
+};
+
+BOOST_FIXTURE_TEST_SUITE(UtilSqlite3Statement, Sqlite3StatementTestFixture)
+
+BOOST_AUTO_TEST_CASE(Basic)
+{
+  // create table
+  BOOST_CHECK_NO_THROW(Sqlite3Statement(db, "CREATE TABLE test (t1 int, t2 text)").step());
+
+  // insert data into table
+  BOOST_CHECK_NO_THROW(Sqlite3Statement(db, "INSERT INTO test VALUES (1, 'test1')").step());
+
+  {
+    Sqlite3Statement stmt(db, "INSERT INTO test VALUES (2, ?)");
+    stmt.bind(1, "test2", std::strlen("test2"), SQLITE_STATIC);
+    stmt.step();
+  }
+
+  {
+    Sqlite3Statement stmt(db, "INSERT INTO test VALUES (3, ?)");
+    stmt.bind(1, "test3", SQLITE_TRANSIENT);
+    stmt.step();
+  }
+
+  Block block(100);
+  block.encode();
+  {
+    Sqlite3Statement stmt(db, "INSERT INTO test VALUES (4, ?)");
+    stmt.bind(1, block, SQLITE_STATIC);
+    stmt.step();
+  }
+
+  {
+    Sqlite3Statement stmt(db, "INSERT INTO test VALUES (5, ?)");
+    stmt.bind(1, reinterpret_cast<const void*>(block.wire()), block.size(), SQLITE_STATIC);
+    stmt.step();
+  }
+
+  {
+    Sqlite3Statement stmt(db, "INSERT INTO test VALUES (?, ?)");
+    stmt.bind(1, 6);
+    stmt.bind(2, "test", SQLITE_TRANSIENT);
+    stmt.step();
+  }
+
+  // check content of the table
+
+  {
+    Sqlite3Statement stmt(db, "SELECT count(*) FROM test");
+    BOOST_CHECK_EQUAL(stmt.step(), SQLITE_ROW);
+    BOOST_CHECK_EQUAL(stmt.getInt(0), 6);
+    BOOST_CHECK_EQUAL(stmt.step(), SQLITE_DONE);
+  }
+
+  {
+    Sqlite3Statement stmt(db, "SELECT t1, t2 FROM test ORDER BY t1");
+    BOOST_CHECK_EQUAL(stmt.step(), SQLITE_ROW);
+    BOOST_CHECK_EQUAL(stmt.getInt(0), 1);
+    BOOST_CHECK_EQUAL(stmt.getString(1), "test1");
+
+    BOOST_CHECK_EQUAL(stmt.step(), SQLITE_ROW);
+    BOOST_CHECK_EQUAL(stmt.getInt(0), 2);
+    BOOST_CHECK_EQUAL(stmt.getString(1), "test2");
+
+    BOOST_CHECK_EQUAL(stmt.step(), SQLITE_ROW);
+    BOOST_CHECK_EQUAL(stmt.getInt(0), 3);
+    BOOST_CHECK_EQUAL(stmt.getString(1), "test3");
+
+    BOOST_CHECK_EQUAL(stmt.step(), SQLITE_ROW);
+    BOOST_CHECK_EQUAL(stmt.getInt(0), 4);
+
+    Block newBlock;
+    BOOST_CHECK_NO_THROW(newBlock = stmt.getBlock(1));
+    BOOST_CHECK_EQUAL(newBlock.type(), 100);
+    BOOST_CHECK(newBlock == block);
+
+    BOOST_CHECK_EQUAL(stmt.step(), SQLITE_ROW);
+    BOOST_CHECK_EQUAL(stmt.getInt(0), 5);
+    BOOST_CHECK_EQUAL(stmt.getSize(1), block.size());
+    BOOST_CHECK_EQUAL_COLLECTIONS(block.begin(), block.end(),
+                                  stmt.getBlob(1), stmt.getBlob(1) + stmt.getSize(1));
+
+    BOOST_CHECK_EQUAL(stmt.step(), SQLITE_ROW);
+    BOOST_CHECK_EQUAL(stmt.step(), SQLITE_DONE);
+  }
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace util
+} // namespace ndn
diff --git a/tests/wscript b/tests/wscript
index f3c1ccf..89a06cc 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -30,6 +30,7 @@
                                  excl=['**/*-osx.t.cpp', '**/*-sqlite3.t.cpp']),
         use='ndn-cxx tests-base BOOST',
         includes='.',
+        defines='UNIT_TEST_CONFIG_PATH=\"%s/tmp-files/\"' %(bld.bldnode),
         install_path=None)
 
     if bld.env['HAVE_OSX_SECURITY']:
