aboutsummaryrefslogtreecommitdiff
path: root/include/sqlitepp.h
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2015-07-18 23:30:42 +0200
committerRobin Krahl <me@robin-krahl.de>2015-07-18 23:30:42 +0200
commit56b56f46f13a7838e113b529a75771a9fb07bdf7 (patch)
treef599b98c83a126845cc834ddbdce7d2b5e52213e /include/sqlitepp.h
parent6228b0a15c86d2105a29cbccb48db6bd83b82f71 (diff)
downloadsqlitepp-56b56f46f13a7838e113b529a75771a9fb07bdf7.tar.gz
sqlitepp-56b56f46f13a7838e113b529a75771a9fb07bdf7.tar.bz2
Refactoring and update.
Diffstat (limited to 'include/sqlitepp.h')
-rw-r--r--include/sqlitepp.h91
1 files changed, 0 insertions, 91 deletions
diff --git a/include/sqlitepp.h b/include/sqlitepp.h
deleted file mode 100644
index db932d2..0000000
--- a/include/sqlitepp.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * (C) 2014 Robin Krahl
- * MIT license -- http://opensource.org/licenses/MIT
- */
-
-#ifndef __SQLITEPP_H
-#define __SQLITEPP_H
-
-#include <memory>
-#include <string>
-
-#include <boost/noncopyable.hpp>
-#include <sqlite3.h>
-
-namespace sqlitepp {
- class Openable {
- public:
- const bool isOpen() const;
-
- protected:
- Openable(const bool open, const std::string & name);
-
- void requireOpen() const;
- void setOpen(const bool open);
-
- private:
- bool m_open;
- const std::string & m_name;
- };
-
- class DatabaseError : public std::runtime_error {
- public:
- DatabaseError(const int errorCode);
- DatabaseError(const int errorCode, const std::string & errorMessage);
-
- const int errorCode() const;
- private:
- const int m_errorCode;
-
- static const std::string getErrorMessage(const int errorCode, const std::string & errorMessage);
- };
-
- class Statement;
-
- class Database : private boost::noncopyable, public Openable {
- friend class Statement;
- public:
- Database();
- Database(const std::string & file);
- ~Database();
-
- void close();
- void execute(const std::string & sql);
- void open(const std::string & file);
- std::shared_ptr<Statement> prepare(const std::string & sql);
-
- private:
- sqlite3 * m_handle;
- };
-
- class Statement : private boost::noncopyable, public Openable {
- public:
- Statement(Database & database, const std::string & statement);
- ~Statement();
-
- void bindDouble(const int index, const double value);
- void bindDouble(const std::string & name, const double value);
- void bindInt(const int index, const int value);
- void bindInt(const std::string & name, const int value);
- void bindString(const int index, const std::string & value);
- void bindString(const std::string & name, const std::string & value);
- const bool canRead() const;
- const int columnCount() const;
- const double readDouble(const int column) const;
- const int readInt(const int column) const;
- const std::string readString(const int column) const;
- const bool step();
- void finalize();
- const bool reset();
-
- private:
- sqlite3_stmt * m_handle;
- bool m_canRead;
-
- int getParameterIndex(const std::string & name) const;
- void handleBindResult(const int index, const int result) const;
- void requireCanRead() const;
- };
-}
-
-#endif \ No newline at end of file