diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-06-06 20:09:57 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-06-06 20:09:57 +0100 |
commit | 3f957f10146c87226b37e02c7b096fc856b41070 (patch) | |
tree | af5b17b0a6a65a6ded4145aa6df19a0fb38f8b89 /libsqlitepp/selectcommand.cpp | |
parent | Move to C++0y (diff) | |
download | libdbpp-sqlite-3f957f10146c87226b37e02c7b096fc856b41070.tar.bz2 libdbpp-sqlite-3f957f10146c87226b37e02c7b096fc856b41070.tar.xz libdbpp-sqlite-3f957f10146c87226b37e02c7b096fc856b41070.zip |
Correctly namespace Column
Diffstat (limited to 'libsqlitepp/selectcommand.cpp')
-rw-r--r-- | libsqlitepp/selectcommand.cpp | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/libsqlitepp/selectcommand.cpp b/libsqlitepp/selectcommand.cpp index a3d5ac7..8b0e8f9 100644 --- a/libsqlitepp/selectcommand.cpp +++ b/libsqlitepp/selectcommand.cpp @@ -3,49 +3,51 @@ #include "error.h" #include <string.h> -class Column : public DB::Column { - public: - Column(const Glib::ustring & n, unsigned int i, sqlite3_stmt * s) : - DB::Column(n, i), - stmt(s) - { - } +namespace SQLite { + class Column : public DB::Column { + public: + Column(const Glib::ustring & n, unsigned int i, sqlite3_stmt * s) : + DB::Column(n, i), + stmt(s) + { + } - bool isNull() const { - return (SQLITE_NULL == sqlite3_column_type(stmt, colNo)); - } + bool isNull() const { + return (SQLITE_NULL == sqlite3_column_type(stmt, colNo)); + } - void apply(DB::HandleField & h) const { - switch (sqlite3_column_type(stmt, colNo)) { - case SQLITE_INTEGER: - h.integer(sqlite3_column_int64(stmt, colNo)); - return; - case SQLITE_FLOAT: - h.floatingpoint(sqlite3_column_double(stmt, colNo)); - return; - case SQLITE_TEXT: - { - auto t = sqlite3_column_text(stmt, colNo); - auto l = sqlite3_column_bytes(stmt, colNo); - h.string(reinterpret_cast<const char *>(t), l); + void apply(DB::HandleField & h) const { + switch (sqlite3_column_type(stmt, colNo)) { + case SQLITE_INTEGER: + h.integer(sqlite3_column_int64(stmt, colNo)); + return; + case SQLITE_FLOAT: + h.floatingpoint(sqlite3_column_double(stmt, colNo)); + return; + case SQLITE_TEXT: + { + auto t = sqlite3_column_text(stmt, colNo); + auto l = sqlite3_column_bytes(stmt, colNo); + h.string(reinterpret_cast<const char *>(t), l); + return; + } + case SQLITE_NULL: + h.null(); return; - } - case SQLITE_NULL: - h.null(); - return; - case SQLITE_BLOB: - throw std::runtime_error("Blobs not supported"); + case SQLITE_BLOB: + throw std::runtime_error("Blobs not supported"); + } + } - - } - void rebind(DB::Command*, unsigned int) const { - throw std::runtime_error("Not implemented"); - } + void rebind(DB::Command*, unsigned int) const { + throw std::runtime_error("Not implemented"); + } - private: - sqlite3_stmt * const stmt; -}; + private: + sqlite3_stmt * const stmt; + }; +} SQLite::SelectCommand::SelectCommand(const Connection * conn, const std::string & sql) : DB::Command(sql), |