diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-24 04:13:24 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-24 04:13:24 +0000 |
commit | 5dd91c7b80443c1f0e747088159c4d8b78d1856d (patch) | |
tree | 226331b6026e722f6a69765963ff19a9436155c1 /libsqlitepp/sqlite-modifycommand.cpp | |
parent | Use parent glibmm (diff) | |
download | libdbpp-sqlite-5dd91c7b80443c1f0e747088159c4d8b78d1856d.tar.bz2 libdbpp-sqlite-5dd91c7b80443c1f0e747088159c4d8b78d1856d.tar.xz libdbpp-sqlite-5dd91c7b80443c1f0e747088159c4d8b78d1856d.zip |
SQLite files prefixed with sqlite-
Diffstat (limited to 'libsqlitepp/sqlite-modifycommand.cpp')
-rw-r--r-- | libsqlitepp/sqlite-modifycommand.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libsqlitepp/sqlite-modifycommand.cpp b/libsqlitepp/sqlite-modifycommand.cpp new file mode 100644 index 0000000..cb5d761 --- /dev/null +++ b/libsqlitepp/sqlite-modifycommand.cpp @@ -0,0 +1,31 @@ +#include "sqlite-modifycommand.h" +#include "sqlite-error.h" +#include <stdlib.h> +#include "sqlite-connection.h" + +SQLite::ModifyCommand::ModifyCommand(const Connection * conn, const std::string & sql) : + DB::Command(sql), + DB::ModifyCommand(sql), + SQLite::Command(conn, sql) +{ +} + +SQLite::ModifyCommand::~ModifyCommand() +{ +} + +unsigned int +SQLite::ModifyCommand::execute(bool anc) +{ + if (sqlite3_step(stmt) != SQLITE_DONE) { + sqlite3_reset(stmt); + throw Error(sqlite3_errmsg(c->db)); + } + unsigned int rows = sqlite3_changes(c->db); + sqlite3_reset(stmt); + if (rows == 0 && !anc) { + throw Error("No rows affected"); + } + return rows; +} + |